increase robustness, when something upstream fails (#19493)

pull/19544/head
Diogo Gomes 2018-12-23 12:29:02 +00:00 committed by Fabian Affolter
parent 5a4e6bbb07
commit 0b22880f22
1 changed files with 6 additions and 1 deletions

View File

@ -92,7 +92,12 @@ class IPMAWeather(WeatherEntity):
async def async_update(self):
"""Update Condition and Forecast."""
with async_timeout.timeout(10, loop=self.hass.loop):
self._condition = await self._station.observation()
_new_condition = await self._station.observation()
if _new_condition is None:
_LOGGER.warning("Could not update weather conditions")
return
self._condition = _new_condition
_LOGGER.debug("Updating station %s, condition %s",
self._station.local, self._condition)
self._forecast = await self._station.forecast()