From 974d6baca2cc39fabdd7af60b63e99e2c37218b8 Mon Sep 17 00:00:00 2001 From: Jules Dejaeghere Date: Fri, 29 Dec 2023 21:40:36 +0100 Subject: [PATCH] Fix lowest temperature for next day if it is currently the night --- custom_components/irm_kmi/weather.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/irm_kmi/weather.py b/custom_components/irm_kmi/weather.py index 112ad00..7026149 100644 --- a/custom_components/irm_kmi/weather.py +++ b/custom_components/irm_kmi/weather.py @@ -106,10 +106,12 @@ class IrmKmiWeather(CoordinatorEntity, WeatherEntity): data: list[Forecast] = self.coordinator.data.get('daily_forecast') if not isinstance(data, list): return None + if len(data) > 1 and not data[0].get('is_daytime') and data[1].get('native_templow') is None: + data[1]['native_templow'] = data[0].get('native_templow') if len(data) > 0 and not data[0].get('is_daytime'): return data if len(data) > 1 and data[0].get('native_templow') is None and not data[1].get('is_daytime'): - data[0]['native_templow'] = data[1]['native_templow'] + data[0]['native_templow'] = data[1].get('native_templow') return [f for f in data if f.get('is_daytime')] async def async_forecast_hourly(self) -> list[Forecast] | None: