diff --git a/fhem/CHANGED b/fhem/CHANGED index e6ff7e096..b0e21ca9e 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - change: 59_Weather: reverted changes in HTML routine (forum #87187) - feature: 59_Weather: italian translations and other (forum #87080) - feature: 49_SSCam: V3.9.1, PTZ control panel added, please consider attributes "ptzPanel_.*" and command "createPTZcontrol" diff --git a/fhem/FHEM/59_Weather.pm b/fhem/FHEM/59_Weather.pm index e08ae1018..5e691ab5a 100755 --- a/fhem/FHEM/59_Weather.pm +++ b/fhem/FHEM/59_Weather.pm @@ -521,45 +521,30 @@ WeatherIconIMGTag($) { } -# number of items for forecast -# 6 => 5 days, 11 => 10 days -# day 0 is 'now', 1 to 10 are forecast -# -use constant FORECASTSIZE => 11; -use constant MAXFORECASTS => 11; - ##################################### + sub -WeatherAsHtmlV($;$;$) +WeatherAsHtmlV($;$) { - my ($d,$items,$pt) = @_; + my ($d,$items) = @_; $d = "" if(!$d); - $items = int(FORECASTSIZE) if( !$items ); - # check number of items - $items = int(FORECASTSIZE) if( $items > int(MAXFORECASTS)); - return "$d is not a Weather instance
" + $items = 10 if( !$items ); + return "$d is not a Weather instance
" if(!$defs{$d} || $defs{$d}{TYPE} ne "Weather"); - $pt = 0 if( !$pt ); my $width= int(ICONSCALE*ICONWIDTH); - my $ret = ''; #class="weather" style="table-layout:fixed" - - $ret .= sprintf('', "$status_items_txt_i18n{4}", ReadingsVal($d, "city", "")) - if ($pt ne 0); - - $ret .= sprintf('', + my $ret = '
%s%s
%s%s: %s
%s°C %s%%
%s
'; + $ret .= sprintf('', $width, WeatherIconIMGTag(ReadingsVal($d, "icon", "")), - "$status_items_txt_i18n{3}", ReadingsVal($d, "condition", ""), - "$status_items_txt_i18n{2}: " . ReadingsVal($d, "temp_c", ""), - "$status_items_txt_i18n{1}: " . ReadingsVal($d, "humidity", ""), + ReadingsVal($d, "temp_c", ""), ReadingsVal($d, "humidity", ""), ReadingsVal($d, "wind_condition", "")); for(my $i=1; $i<$items; $i++) { - $ret .= sprintf('', + $ret .= sprintf('', $width, WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", "")), ReadingsVal($d, "fc${i}_day_of_week", ""), @@ -567,46 +552,44 @@ WeatherAsHtmlV($;$;$) ReadingsVal($d, "fc${i}_low_c", ""), ReadingsVal($d, "fc${i}_high_c", "")); } - $ret .= "
%s%s
%s°C %s%%
%s
%s%s: %s
min %s°C max %s°C
%s%s: %s
min %s°C max %s°C

"; - + $ret .= ""; return $ret; } sub -WeatherAsHtml($;$;$) +WeatherAsHtml($;$) { - my ($d,$i,$p) = @_; - WeatherAsHtmlV($d,$i,$p); + my ($d,$i) = @_; + WeatherAsHtmlV($d,$i); } sub -WeatherAsHtmlH($;$;$) +WeatherAsHtmlH($;$) { - my ($d,$items,$pt) = @_; + my ($d,$items) = @_; $d = "" if(!$d); - $items = int(FORECASTSIZE) if( !$items ); - #chek number of items - $items = int(FORECASTSIZE) if( $items > int(MAXFORECASTS)); + $items = 10 if( !$items ); return "$d is not a Weather instance
" if(!$defs{$d} || $defs{$d}{TYPE} ne "Weather"); - $pt = 0 if( !$pt ); + my $width= int(ICONSCALE*ICONWIDTH); - my $ret = ''; #class="weather" - $ret .= sprintf('', $items, "$status_items_txt_i18n{4}", ReadingsVal($d, "city", "")) - if ($pt ne 0); + + my $format= ''; + + my $ret = '
%s%s
%s
%s
%s°C %s%%
%s
'; # icons - $ret .= sprintf('', $width, WeatherIconIMGTag(ReadingsVal($d, "icon", ""))); + $ret .= sprintf('', $width, WeatherIconIMGTag(ReadingsVal($d, "icon", ""))); for(my $i=1; $i<$items; $i++) { - $ret .= sprintf('', $width, WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", ""))); + $ret .= sprintf('', $width, WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", ""))); } $ret .= ''; # condition - $ret .= sprintf('', "$status_items_txt_i18n{3}", ReadingsVal($d, "condition", "")); + $ret .= sprintf('', ReadingsVal($d, "condition", "")); for(my $i=1; $i<$items; $i++) { $ret .= sprintf('', ReadingsVal($d, "fc${i}_day_of_week", ""), ReadingsVal($d, "fc${i}_condition", "")); @@ -614,35 +597,33 @@ WeatherAsHtmlH($;$;$) $ret .= ''; # temp/hum | min - $ret .= sprintf('', "$status_items_txt_i18n{2}: " . ReadingsVal($d, "temp_c", ""), "$status_items_txt_i18n{1}: " . ReadingsVal($d, "humidity", "")); + $ret .= sprintf('', ReadingsVal($d, "temp_c", ""), ReadingsVal($d, "humidity", "")); for(my $i=1; $i<$items; $i++) { $ret .= sprintf('', ReadingsVal($d, "fc${i}_low_c", "")); } $ret .= ''; # wind | max - $ret .= sprintf('', ReadingsVal($d, "wind_condition", "")); + $ret .= sprintf('', ReadingsVal($d, "wind_condition", "")); for(my $i=1; $i<$items; $i++) { $ret .= sprintf('', ReadingsVal($d, "fc${i}_high_c", "")); } $ret .= "
%s
%s%s%s
%s: %s
%s%s: %s
%s°C %s%%
%s°C %s%%min %s°C
%s
%smax %s°C
"; - $ret .= "
"; return $ret; } sub -WeatherAsHtmlD($;$;$) +WeatherAsHtmlD($;$) { - my ($d,$i,$p) = @_; + my ($d,$i) = @_; if($FW_ss) { - WeatherAsHtmlV($d,$i,$p); + WeatherAsHtmlV($d,$i); } else { - WeatherAsHtmlH($d,$i,$p); + WeatherAsHtmlH($d,$i); } } - #####################################