From 437d04b87c2d7775622a9187e5eb57e2c86aae33 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 17 Oct 2025 12:20:04 +0200 Subject: [PATCH 1/2] Fix Weather.pm to use READINGS instead of readings This commit corrects the hash key used to access device readings in the Weather.pm module. All instances of the lowercase 'readings' hash key have been changed to the uppercase 'READINGS', which is the standard convention in FHEM. This fixes potential issues where weather data wasn't being properly accessed or displayed because the module was looking for readings in the wrong hash location. The change affects the Get function and HTML rendering methods for both vertical and horizontal layouts. --- lib/FHEM/Core/Weather.pm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/FHEM/Core/Weather.pm b/lib/FHEM/Core/Weather.pm index 28e975a..64d4b53 100644 --- a/lib/FHEM/Core/Weather.pm +++ b/lib/FHEM/Core/Weather.pm @@ -644,13 +644,13 @@ sub Get { my $reading = shift @$aRef // return; my $value; - if ( defined( $hash->{readings}->{$reading} ) ) { - $value = $hash->{readings}->{$reading}->{VAL}; + if ( defined( $hash->{READINGS}->{$reading} ) ) { + $value = $hash->{READINGS}->{$reading}->{VAL}; } else { my $rt = ''; - if ( defined( $hash->{readings} ) ) { - $rt = join( ":noArg ", sort keys %{ $hash->{readings} } ); + if ( defined( $hash->{READINGS} ) ) { + $rt = join( ":noArg ", sort keys %{ $hash->{READINGS} } ); } return "Unknown reading $reading, choose one of " . $rt; @@ -933,8 +933,8 @@ sub WeatherAsHtmlV { else { $fc = ( ( - defined( $h->{readings}->{fc1_day_of_week} ) - && $h->{readings}->{fc1_day_of_week} + defined( $h->{READINGS}->{fc1_day_of_week} ) + && $h->{READINGS}->{fc1_day_of_week} ) ? 'fc' : 'hfc' ); } @@ -950,8 +950,8 @@ sub WeatherAsHtmlV { ); for ( my $i = 1 ; $i < $items ; $i++ ) { - if ( defined( $h->{readings}->{"${fc}${i}_low_c"} ) - && $h->{readings}->{"${fc}${i}_low_c"} ) + if ( defined( $h->{READINGS}->{"${fc}${i}_low_c"} ) + && $h->{READINGS}->{"${fc}${i}_low_c"} ) { $ret .= sprintf( '%s%s: %s
min %s°C max %s°C
%s', @@ -1021,8 +1021,8 @@ sub WeatherAsHtmlH { else { $fc = ( ( - defined( $h->{readings}->{fc1_day_of_week} ) - && $h->{readings}->{fc1_day_of_week} + defined( $h->{READINGS}->{fc1_day_of_week} ) + && $h->{READINGS}->{fc1_day_of_week} ) ? 'fc' : 'hfc' ); } @@ -1056,8 +1056,8 @@ sub WeatherAsHtmlH { ::ReadingsVal( $d, "humidity", "" ) ); for ( my $i = 1 ; $i < $items ; $i++ ) { - if ( defined( $h->{readings}->{"${fc}${i}_low_c"} ) - && $h->{readings}->{"${fc}${i}_low_c"} ) + if ( defined( $h->{READINGS}->{"${fc}${i}_low_c"} ) + && $h->{READINGS}->{"${fc}${i}_low_c"} ) { $ret .= sprintf( 'min %s°C', ::ReadingsVal( $d, "${fc}${i}_low_c", " - " ) ); @@ -1074,8 +1074,8 @@ sub WeatherAsHtmlH { $ret .= sprintf( '%s', ::ReadingsVal( $d, "wind_condition", "" ) ); for ( my $i = 1 ; $i < $items ; $i++ ) { - if ( defined( $h->{readings}->{"${fc}${i}_high_c"} ) - && $h->{readings}->{"${fc}${i}_high_c"} ) + if ( defined( $h->{READINGS}->{"${fc}${i}_high_c"} ) + && $h->{READINGS}->{"${fc}${i}_high_c"} ) { $ret .= sprintf( 'max %s°C', ::ReadingsVal( $d, "${fc}${i}_high_c", " - " ) ); -- 2.49.1 From 0ab46dd00b6ff171ad1c85cc85207ab2f187754c Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Fri, 17 Oct 2025 12:40:07 +0200 Subject: [PATCH 2/2] Bump Weather module version to v2.3.2 Updated the version number of the Weather module from v2.3.1 to v2.3.2 in the module metadata. This version increment likely corresponds to minor bugfixes or improvements that have been implemented in the module. The version change ensures proper tracking of module updates for users and package management systems. --- FHEM/59_Weather.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FHEM/59_Weather.pm b/FHEM/59_Weather.pm index 96068ad..9e9ea1e 100755 --- a/FHEM/59_Weather.pm +++ b/FHEM/59_Weather.pm @@ -516,7 +516,7 @@ __END__ ], "release_status": "stable", "license": "GPL_2", - "version": "v2.3.1", + "version": "v2.3.2", "author": [ "Marko Oldenburg " ], -- 2.49.1