Add current intraday price ranking to Tibber price sensor (#124595)

pull/124808/head
Kristian Haugene 2024-08-28 18:05:27 +02:00 committed by GitHub
parent 9153d16a6d
commit 25cdd737a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -383,6 +383,7 @@ class TibberSensorElPrice(TibberSensor):
"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
@ -411,8 +412,9 @@ class TibberSensorElPrice(TibberSensor):
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)