Tibber, Add price level (#22085)

* Add price level to Tibber sensor

* bump pyTibber version
pull/22130/head
Daniel Høyer Iversen 2019-03-17 09:34:50 +01:00 committed by Fabian Affolter
parent cf5ba7d922
commit 54dfc3e2b4
3 changed files with 7 additions and 5 deletions

View File

@ -11,7 +11,7 @@ from homeassistant.const import (EVENT_HOMEASSISTANT_STOP, CONF_ACCESS_TOKEN,
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
REQUIREMENTS = ['pyTibber==0.9.6'] REQUIREMENTS = ['pyTibber==0.9.8']
DOMAIN = 'tibber' DOMAIN = 'tibber'

View File

@ -142,6 +142,7 @@ class TibberSensorElPrice(Entity):
self._last_data_timestamp = price_time self._last_data_timestamp = price_time
if 0 <= time_diff < 60: if 0 <= time_diff < 60:
state = price_total state = price_total
level = self._tibber_home.price_level[key]
self._last_updated = price_time self._last_updated = price_time
if now.date() == price_time.date(): if now.date() == price_time.date():
max_price = max(max_price, price_total) max_price = max(max_price, price_total)
@ -152,6 +153,7 @@ class TibberSensorElPrice(Entity):
self._device_state_attributes['max_price'] = max_price self._device_state_attributes['max_price'] = max_price
self._device_state_attributes['avg_price'] = round(sum_price / num, 3) self._device_state_attributes['avg_price'] = round(sum_price / num, 3)
self._device_state_attributes['min_price'] = min_price self._device_state_attributes['min_price'] = min_price
self._device_state_attributes['price_level'] = level
return state is not None return state is not None

View File

@ -925,7 +925,7 @@ pyRFXtrx==0.23
# pySwitchmate==0.4.5 # pySwitchmate==0.4.5
# homeassistant.components.tibber # homeassistant.components.tibber
pyTibber==0.9.6 pyTibber==0.9.8
# homeassistant.components.dlink.switch # homeassistant.components.dlink.switch
pyW215==0.6.0 pyW215==0.6.0