mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Fix error when API doesn't return a forecast. (#20365)
* add guard * wrong logic
This commit is contained in:
parent
5580bec1d3
commit
074fcd96ed
@ -116,6 +116,9 @@ class IPMAWeather(WeatherEntity):
|
|||||||
@property
|
@property
|
||||||
def condition(self):
|
def condition(self):
|
||||||
"""Return the current condition."""
|
"""Return the current condition."""
|
||||||
|
if not self._forecast:
|
||||||
|
return
|
||||||
|
|
||||||
return next((k for k, v in CONDITION_CLASSES.items()
|
return next((k for k, v in CONDITION_CLASSES.items()
|
||||||
if self._forecast[0].idWeatherType in v), None)
|
if self._forecast[0].idWeatherType in v), None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user