diff --git a/59_Weather.pm b/59_Weather.pm index c62d721..fccecab 100755 --- a/59_Weather.pm +++ b/59_Weather.pm @@ -764,10 +764,10 @@ sub WeatherAsHtmlV($;$$) { return $ret; } -sub WeatherAsHtml($;$) { - my ( $d, $i ) = @_; +sub WeatherAsHtml($;$$) { + my ( $d, $items, $i ) = @_; - WeatherAsHtmlV( $d, $i ); + WeatherAsHtmlV( $d, $items, $i ); } sub WeatherAsHtmlH($;$$) { @@ -832,8 +832,13 @@ sub WeatherAsHtmlH($;$$) { ReadingsVal( $d, "humidity", "" ) ); for ( my $i = 1 ; $i < $items ; $i++ ) { - $ret .= sprintf( 'min %s°C', - ReadingsVal( $d, "${fc}${i}_low_c", " - " ) ); + if(defined($h->{READINGS}->{"${fc}${i}_low_c"}) and $h->{READINGS}->{"${fc}${i}_low_c"}){ + $ret .= sprintf( 'min %s°C', + ReadingsVal( $d, "${fc}${i}_low_c", " - " ) ); + }else{ + $ret .= sprintf( ' %s°C', + ReadingsVal( $d, "${fc}${i}_temperature", " - " ) ); + } } $ret .= ''; @@ -841,22 +846,24 @@ sub WeatherAsHtmlH($;$$) { $ret .= sprintf( '%s', ReadingsVal( $d, "wind_condition", "" ) ); for ( my $i = 1 ; $i < $items ; $i++ ) { - $ret .= sprintf( 'max %s°C', - ReadingsVal( $d, "${fc}${i}_high_c", " - " ) ); + if(defined($h->{READINGS}->{"${fc}${i}_high_c"}) and $h->{READINGS}->{"${fc}${i}_high_c"}){ + $ret .= sprintf( 'max %s°C', + ReadingsVal( $d, "${fc}${i}_high_c", " - " ) ); + } } $ret .= ""; return $ret; } -sub WeatherAsHtmlD($;$) { - my ( $d, $i ) = @_; +sub WeatherAsHtmlD($;$$) { + my ( $d, $items, $i ) = @_; if ($FW_ss) { - WeatherAsHtmlV( $d, $i ); + WeatherAsHtmlV( $d, $items, $i ); } else { - WeatherAsHtmlH( $d, $i ); + WeatherAsHtmlH( $d, $items, $i ); } } @@ -957,7 +964,7 @@ sub WeatherAsHtmlD($;$) { to limit the numer of icons to display.

Example:
-      define MyWeatherWeblink weblink htmlCode { WeatherAsHtmlH("MyWeather") }
+      define MyWeatherWeblink weblink htmlCode { WeatherAsHtmlH("MyWeather",10,"h") }
     
@@ -1130,7 +1137,7 @@ sub WeatherAsHtmlD($;$) { Wird der dritte Parameter verwendet muss auch der zweite Parameter für die Anzahl der darzustellenden Icons gesetzt werden.

Beispiel:
-      define MyWeatherWeblink weblink htmlCode { WeatherAsHtmlH("MyWeather") }
+      define MyWeatherWeblink weblink htmlCode { WeatherAsHtmlH("MyWeather",10,"h") }