From 1b31cf19e9152cf5fef5b2fb3ae22dc7d90cc000 Mon Sep 17 00:00:00 2001 From: Veeck Date: Sat, 16 Aug 2025 20:56:52 +0200 Subject: [PATCH] Thoroughly check for precipitationAmount values in weathergov provider (#3859) Fixes #3856 --------- Co-authored-by: veeck --- CHANGELOG.md | 3 ++- modules/default/weather/providers/weathergov.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e662b1d7..c119ed78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,8 +29,9 @@ Thanks to: @dathbe. ### Fixed -- [calendar] Fixed broken unittest that only broke at 1st of july and 1st of january (#3830) +- [calendar] Fixed broken unittest that only broke on the 1st of July and 1st of january (#3830) - [clock] Fixed missing icons when no other modules with icons is loaded (#3834) +- [weather] Fixed handling of empty values in weathergov providers handling of precipitationAmount (#3859) ## [2.32.0] - 2025-07-01 diff --git a/modules/default/weather/providers/weathergov.js b/modules/default/weather/providers/weathergov.js index d8fa621a..602e409c 100644 --- a/modules/default/weather/providers/weathergov.js +++ b/modules/default/weather/providers/weathergov.js @@ -218,7 +218,7 @@ WeatherProvider.register("weathergov", { currentWeather.minTemperature = currentWeatherData.minTemperatureLast24Hours.value; currentWeather.maxTemperature = currentWeatherData.maxTemperatureLast24Hours.value; currentWeather.humidity = Math.round(currentWeatherData.relativeHumidity.value); - currentWeather.precipitationAmount = currentWeatherData.precipitationLastHour.value ? currentWeatherData.precipitationLastHour.value : currentWeatherData.precipitationLast3Hours.value; + currentWeather.precipitationAmount = currentWeatherData.precipitationLastHour?.value ?? currentWeatherData.precipitationLast3Hours?.value; if (currentWeatherData.heatIndex.value !== null) { currentWeather.feelsLikeTemp = currentWeatherData.heatIndex.value; } else if (currentWeatherData.windChill.value !== null) {