Fix error when API doesn't return a forecast. (#20365)
* add guard * wrong logic
This commit is contained in:
parent
2b542b7789
commit
65d9460e09
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue