Fix error when API doesn't return a forecast. (#20365)

* add guard

* wrong logic
This commit is contained in:
Diogo Gomes
2019-01-23 21:14:21 -08:00
committed by Paulus Schoutsen
parent 5580bec1d3
commit 074fcd96ed
+3
View File
@@ -116,6 +116,9 @@ class IPMAWeather(WeatherEntity):
@property
def condition(self):
"""Return the current condition."""
if not self._forecast:
return
return next((k for k, v in CONDITION_CLASSES.items()
if self._forecast[0].idWeatherType in v), None)