mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
59_Weather: reverted changes in HTML routine (forum #87187)
git-svn-id: https://svn.fhem.de/fhem/trunk@16644 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2b6ceb14cd
commit
1a46beec3c
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# 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: 59_Weather: italian translations and other (forum #87080)
|
||||||
- feature: 49_SSCam: V3.9.1, PTZ control panel added, please consider
|
- feature: 49_SSCam: V3.9.1, PTZ control panel added, please consider
|
||||||
attributes "ptzPanel_.*" and command "createPTZcontrol"
|
attributes "ptzPanel_.*" and command "createPTZcontrol"
|
||||||
|
@ -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
|
sub
|
||||||
WeatherAsHtmlV($;$;$)
|
WeatherAsHtmlV($;$)
|
||||||
{
|
{
|
||||||
|
|
||||||
my ($d,$items,$pt) = @_;
|
my ($d,$items) = @_;
|
||||||
$d = "<none>" if(!$d);
|
$d = "<none>" if(!$d);
|
||||||
$items = int(FORECASTSIZE) if( !$items );
|
$items = 10 if( !$items );
|
||||||
# check number of items
|
return "$d is not a Weather instance<br>"
|
||||||
$items = int(FORECASTSIZE) if( $items > int(MAXFORECASTS));
|
|
||||||
return "$d is not a Weather instance<br/>"
|
|
||||||
if(!$defs{$d} || $defs{$d}{TYPE} ne "Weather");
|
if(!$defs{$d} || $defs{$d}{TYPE} ne "Weather");
|
||||||
$pt = 0 if( !$pt );
|
|
||||||
|
|
||||||
my $width= int(ICONSCALE*ICONWIDTH);
|
my $width= int(ICONSCALE*ICONWIDTH);
|
||||||
|
|
||||||
my $ret = '<table class="block">'; #class="weather" style="table-layout:fixed"
|
my $ret = '<table class="weather">';
|
||||||
|
$ret .= sprintf('<tr><td class="weatherIcon" width=%d>%s</td><td class="weatherValue">%s<br>%s°C %s%%<br>%s</td></tr>',
|
||||||
$ret .= sprintf('<tr><td style="text-align:left" colspan=2>%s%s</td></tr>', "$status_items_txt_i18n{4}", ReadingsVal($d, "city", ""))
|
|
||||||
if ($pt ne 0);
|
|
||||||
|
|
||||||
$ret .= sprintf('<tr><td class="weatherIcon" style="width:%dpx;text-align:center">%s</td><td class="weatherValue">%s: %s<br>%s°C %s%%<br>%s</td></tr>',
|
|
||||||
$width,
|
$width,
|
||||||
WeatherIconIMGTag(ReadingsVal($d, "icon", "")),
|
WeatherIconIMGTag(ReadingsVal($d, "icon", "")),
|
||||||
"$status_items_txt_i18n{3}",
|
|
||||||
ReadingsVal($d, "condition", ""),
|
ReadingsVal($d, "condition", ""),
|
||||||
"$status_items_txt_i18n{2}: " . ReadingsVal($d, "temp_c", ""),
|
ReadingsVal($d, "temp_c", ""), ReadingsVal($d, "humidity", ""),
|
||||||
"$status_items_txt_i18n{1}: " . ReadingsVal($d, "humidity", ""),
|
|
||||||
ReadingsVal($d, "wind_condition", ""));
|
ReadingsVal($d, "wind_condition", ""));
|
||||||
|
|
||||||
for(my $i=1; $i<$items; $i++) {
|
for(my $i=1; $i<$items; $i++) {
|
||||||
$ret .= sprintf('<tr><td class="weatherIcon" style="width:%dpx;text-align:left">%s</td><td class="weatherValue"><span class="weatherDay">%s: %s</span><br><span class="weatherMin">min %s°C</span> <span class="weatherMax">max %s°C</span></td></tr>',
|
$ret .= sprintf('<tr><td class="weatherIcon" width=%d>%s</td><td class="weatherValue"><span class="weatherDay">%s: %s</span><br><span class="weatherMin">min %s°C</span> <span class="weatherMax">max %s°C</span></td></tr>',
|
||||||
$width,
|
$width,
|
||||||
WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", "")),
|
WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", "")),
|
||||||
ReadingsVal($d, "fc${i}_day_of_week", ""),
|
ReadingsVal($d, "fc${i}_day_of_week", ""),
|
||||||
@ -567,46 +552,44 @@ WeatherAsHtmlV($;$;$)
|
|||||||
ReadingsVal($d, "fc${i}_low_c", ""), ReadingsVal($d, "fc${i}_high_c", ""));
|
ReadingsVal($d, "fc${i}_low_c", ""), ReadingsVal($d, "fc${i}_high_c", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret .= "</table><br/>";
|
$ret .= "</table>";
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
WeatherAsHtml($;$;$)
|
WeatherAsHtml($;$)
|
||||||
{
|
{
|
||||||
my ($d,$i,$p) = @_;
|
my ($d,$i) = @_;
|
||||||
WeatherAsHtmlV($d,$i,$p);
|
WeatherAsHtmlV($d,$i);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
WeatherAsHtmlH($;$;$)
|
WeatherAsHtmlH($;$)
|
||||||
{
|
{
|
||||||
|
|
||||||
my ($d,$items,$pt) = @_;
|
my ($d,$items) = @_;
|
||||||
$d = "<none>" if(!$d);
|
$d = "<none>" if(!$d);
|
||||||
$items = int(FORECASTSIZE) if( !$items );
|
$items = 10 if( !$items );
|
||||||
#chek number of items
|
|
||||||
$items = int(FORECASTSIZE) if( $items > int(MAXFORECASTS));
|
|
||||||
return "$d is not a Weather instance<br>"
|
return "$d is not a Weather instance<br>"
|
||||||
if(!$defs{$d} || $defs{$d}{TYPE} ne "Weather");
|
if(!$defs{$d} || $defs{$d}{TYPE} ne "Weather");
|
||||||
$pt = 0 if( !$pt );
|
|
||||||
my $width= int(ICONSCALE*ICONWIDTH);
|
my $width= int(ICONSCALE*ICONWIDTH);
|
||||||
|
|
||||||
my $ret = '<table class="block wide" style="table-layout:fixed">'; #class="weather"
|
|
||||||
|
|
||||||
$ret .= sprintf('<tr><td style="text-align:left" colspan=%d>%s%s</td></tr>', $items, "$status_items_txt_i18n{4}", ReadingsVal($d, "city", ""))
|
|
||||||
if ($pt ne 0);
|
my $format= '<td><table border=1><tr><td class="weatherIcon" width=%d>%s</td></tr><tr><td class="weatherValue">%s</td></tr><tr><td class="weatherValue">%s°C %s%%</td></tr><tr><td class="weatherValue">%s</td></tr></table></td>';
|
||||||
|
|
||||||
|
my $ret = '<table class="weather">';
|
||||||
|
|
||||||
# icons
|
# icons
|
||||||
$ret .= sprintf('<tr><td class="weatherIcon" style="width:%dpx;text-align:center">%s</td>', $width, WeatherIconIMGTag(ReadingsVal($d, "icon", "")));
|
$ret .= sprintf('<tr><td class="weatherIcon" width=%d>%s</td>', $width, WeatherIconIMGTag(ReadingsVal($d, "icon", "")));
|
||||||
for(my $i=1; $i<$items; $i++) {
|
for(my $i=1; $i<$items; $i++) {
|
||||||
$ret .= sprintf('<td class="weatherIcon" style="width:%dpx;text-align:center">%s</td>', $width, WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", "")));
|
$ret .= sprintf('<td class="weatherIcon" width=%d>%s</td>', $width, WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", "")));
|
||||||
}
|
}
|
||||||
$ret .= '</tr>';
|
$ret .= '</tr>';
|
||||||
|
|
||||||
# condition
|
# condition
|
||||||
$ret .= sprintf('<tr><td class="weatherDay">%s: %s</td>', "$status_items_txt_i18n{3}", ReadingsVal($d, "condition", ""));
|
$ret .= sprintf('<tr><td class="weatherDay">%s</td>', ReadingsVal($d, "condition", ""));
|
||||||
for(my $i=1; $i<$items; $i++) {
|
for(my $i=1; $i<$items; $i++) {
|
||||||
$ret .= sprintf('<td class="weatherDay">%s: %s</td>', ReadingsVal($d, "fc${i}_day_of_week", ""),
|
$ret .= sprintf('<td class="weatherDay">%s: %s</td>', ReadingsVal($d, "fc${i}_day_of_week", ""),
|
||||||
ReadingsVal($d, "fc${i}_condition", ""));
|
ReadingsVal($d, "fc${i}_condition", ""));
|
||||||
@ -614,7 +597,7 @@ WeatherAsHtmlH($;$;$)
|
|||||||
$ret .= '</tr>';
|
$ret .= '</tr>';
|
||||||
|
|
||||||
# temp/hum | min
|
# temp/hum | min
|
||||||
$ret .= sprintf('<tr><td class="weatherMin">%s°C %s%%</td>', "$status_items_txt_i18n{2}: " . ReadingsVal($d, "temp_c", ""), "$status_items_txt_i18n{1}: " . ReadingsVal($d, "humidity", ""));
|
$ret .= sprintf('<tr><td class="weatherMin">%s°C %s%%</td>', ReadingsVal($d, "temp_c", ""), ReadingsVal($d, "humidity", ""));
|
||||||
for(my $i=1; $i<$items; $i++) {
|
for(my $i=1; $i<$items; $i++) {
|
||||||
$ret .= sprintf('<td class="weatherMin">min %s°C</td>', ReadingsVal($d, "fc${i}_low_c", ""));
|
$ret .= sprintf('<td class="weatherMin">min %s°C</td>', ReadingsVal($d, "fc${i}_low_c", ""));
|
||||||
}
|
}
|
||||||
@ -626,23 +609,21 @@ WeatherAsHtmlH($;$;$)
|
|||||||
$ret .= sprintf('<td class="weatherMax">max %s°C</td>', ReadingsVal($d, "fc${i}_high_c", ""));
|
$ret .= sprintf('<td class="weatherMax">max %s°C</td>', ReadingsVal($d, "fc${i}_high_c", ""));
|
||||||
}
|
}
|
||||||
$ret .= "</tr></table>";
|
$ret .= "</tr></table>";
|
||||||
$ret .= "</table><br/>";
|
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
WeatherAsHtmlD($;$;$)
|
WeatherAsHtmlD($;$)
|
||||||
{
|
{
|
||||||
my ($d,$i,$p) = @_;
|
my ($d,$i) = @_;
|
||||||
if($FW_ss) {
|
if($FW_ss) {
|
||||||
WeatherAsHtmlV($d,$i,$p);
|
WeatherAsHtmlV($d,$i);
|
||||||
} else {
|
} else {
|
||||||
WeatherAsHtmlH($d,$i,$p);
|
WeatherAsHtmlH($d,$i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user