diff --git a/homeassistant/components/tibber/sensor.py b/homeassistant/components/tibber/sensor.py index 1fb291bad5e..bb5ebe8011f 100644 --- a/homeassistant/components/tibber/sensor.py +++ b/homeassistant/components/tibber/sensor.py @@ -102,14 +102,6 @@ class TibberSensorElPrice(TibberSensor): async def async_update(self): """Get the latest data and updates the states.""" now = dt_util.now() - if ( - self._tibber_home.current_price_total - and self._last_updated - and self._last_updated.hour == now.hour - and self._tibber_home.last_data_timestamp - ): - return - if ( not self._tibber_home.last_data_timestamp or (self._tibber_home.last_data_timestamp - now).total_seconds() @@ -119,6 +111,14 @@ class TibberSensorElPrice(TibberSensor): _LOGGER.debug("Asking for new data") await self._fetch_data() + elif ( + self._tibber_home.current_price_total + and self._last_updated + and self._last_updated.hour == now.hour + and self._tibber_home.last_data_timestamp + ): + return + res = self._tibber_home.current_price_data() self._state, price_level, self._last_updated = res self._device_state_attributes["price_level"] = price_level