Skip to content

Commit

Permalink
Add current intraday price ranking to Tibber price sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
haugene committed Aug 27, 2024
1 parent 9cae786 commit 0b29a21
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

Check warning on line 415 in homeassistant/components/tibber/sensor.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/tibber/sensor.py#L415

Added line #L415 was not covered by tests
self._attr_extra_state_attributes["price_level"] = price_level
self._attr_extra_state_attributes["intraday_price_ranking"] = price_rank

Check warning on line 417 in homeassistant/components/tibber/sensor.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/tibber/sensor.py#L417

Added line #L417 was not covered by tests

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

0 comments on commit 0b29a21

Please sign in to comment.