From 4a4dabaaa5769ee69b12b0f808a09b3423603596 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 7 Jul 2022 09:03:43 +0200 Subject: [PATCH] Fix openweathermap hourly forecast (#74578) --- homeassistant/components/openweathermap/weather.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/openweathermap/weather.py b/homeassistant/components/openweathermap/weather.py index ea439a35586..9948ecc0428 100644 --- a/homeassistant/components/openweathermap/weather.py +++ b/homeassistant/components/openweathermap/weather.py @@ -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)