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

* add guard

* wrong logic
This commit is contained in:
Diogo Gomes authored and Paulus Schoutsen committed 2019-01-23 21:14:21 -08:00
1 parent 5580bec1d3
commit 074fcd96ed
1 file changed
+3
+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)