Fix openweathermap hourly forecast (#74578)

pull/74579/head
Erik Montnemery 2022-07-07 09:03:43 +02:00 committed by GitHub
parent 104d236646
commit 4a4dabaaa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -143,7 +143,11 @@ class OpenWeatherMapWeather(WeatherEntity):
"""Return the forecast array."""
api_forecasts = self._weather_coordinator.data[ATTR_API_FORECAST]
forecasts = [
{ha_key: forecast[api_key] for api_key, ha_key in FORECAST_MAP.items()}
{
ha_key: forecast[api_key]
for api_key, ha_key in FORECAST_MAP.items()
if api_key in forecast
}
for forecast in api_forecasts
]
return cast(list[Forecast], forecasts)