Skip to content

Commit

Permalink
Add current intraday price ranking to Tibber price sensor (home-assis…
Browse files Browse the repository at this point in the history
  • Loading branch information
haugene authored and Gigatrappeur committed Aug 28, 2024
1 parent e5cb702 commit e55d8d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion homeassistant/components/tibber/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ def __init__(self, tibber_home: tibber.TibberHome) -> None:
"off_peak_1": None,
"peak": None,
"off_peak_2": None,
"intraday_price_ranking": None,
}
self._attr_icon = ICON
self._attr_unique_id = self._tibber_home.home_id
Expand Down Expand Up @@ -411,8 +412,9 @@ async def async_update(self) -> None:
return

res = self._tibber_home.current_price_data()
self._attr_native_value, price_level, self._last_updated, _ = res
self._attr_native_value, price_level, self._last_updated, price_rank = res
self._attr_extra_state_attributes["price_level"] = price_level
self._attr_extra_state_attributes["intraday_price_ranking"] = price_rank

attrs = self._tibber_home.current_attributes()
self._attr_extra_state_attributes.update(attrs)
Expand Down

0 comments on commit e55d8d2

Please sign in to comment.