diff --git a/fhem/CHANGED b/fhem/CHANGED
index 5df591ea2..484d3fd27 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -2,7 +2,7 @@
- SVN
- feature: SYSSTAT: allow (remote) monitoring system uptime
- feature: new module 98_openweathermap.pm added (betateilchen)
- - feature: WeatherAsHtmlH() added to 59_Weather.pm (Boris)
+ - feature: WeatherAsHtmlH(), WeatherAsHtmlD() added to 59_Weather.pm (Boris)
- feature: new module I2C_BMP180 for reading I2C digital pressure sensor BMP180
or BMP085 connected to Raspberry Pi (Dirk)
- feature: new module 35_SWAP_0000002200000003 for panstamp rgb led driver
diff --git a/fhem/FHEM/59_Weather.pm b/fhem/FHEM/59_Weather.pm
index 392987319..31e713cc8 100755
--- a/fhem/FHEM/59_Weather.pm
+++ b/fhem/FHEM/59_Weather.pm
@@ -514,28 +514,57 @@ WeatherAsHtmlH($)
if(!$defs{$d} || $defs{$d}{TYPE} ne "Weather");
my $width= int(ICONSCALE*ICONWIDTH);
+
+
+
+ my $format= '
| ';
- my $ret = sprintf(' | | | |
---|
', $width);
- $ret .= sprintf(' | ',
- $width,
- WeatherIconIMGTag(ReadingsVal($d, "icon", "")),
- ReadingsVal($d, "condition", ""),
- ReadingsVal($d, "temp_c", ""), ReadingsVal($d, "humidity", ""),
- ReadingsVal($d, "wind_condition", ""));
-
-
+ my $ret = '';
+
+ # icons
+ $ret .= sprintf('%s | ', $width, WeatherIconIMGTag(ReadingsVal($d, "icon", "")));
for(my $i=1; $i<=5; $i++) {
- $ret .= sprintf('%s | %s: %s min %s°C max %s°C |
| ',
- $width,
- WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", "")),
- ReadingsVal($d, "fc${i}_day_of_week", ""),
- ReadingsVal($d, "fc${i}_condition", ""),
- ReadingsVal($d, "fc${i}_low_c", ""), ReadingsVal($d, "fc${i}_high_c", ""));
+ $ret .= sprintf('%s | ', $width, WeatherIconIMGTag(ReadingsVal($d, "fc${i}_icon", "")));
+ }
+ $ret .= '
';
+
+ # condition
+ $ret .= sprintf('%s | ', ReadingsVal($d, "condition", ""));
+ for(my $i=1; $i<=5; $i++) {
+ $ret .= sprintf('%s: %s | ', ReadingsVal($d, "fc${i}_day_of_week", ""),
+ ReadingsVal($d, "fc${i}_condition", ""));
+ }
+ $ret .= '
';
+
+ # temp/hum | min
+ $ret .= sprintf('%s°C %s%% | ', ReadingsVal($d, "temp_c", ""), ReadingsVal($d, "humidity", ""));
+ for(my $i=1; $i<=5; $i++) {
+ $ret .= sprintf('min %s°C | ', ReadingsVal($d, "fc${i}_low_c", ""));
+ }
+ $ret .= '
';
+
+ # wind | max
+ $ret .= sprintf('%s | ', ReadingsVal($d, "wind_condition", ""));
+ for(my $i=1; $i<=5; $i++) {
+ $ret .= sprintf('max %s°C | ', ReadingsVal($d, "fc${i}_high_c", ""));
}
-
$ret .= "
";
+
return $ret;
}
+
+sub
+WeatherAsHtmlD($)
+{
+ my ($d) = @_;
+ if($FW_ss) {
+ WeatherAsHtmlV($d);
+ } else {
+ WeatherAsHtmlH($d);
+ }
+}
+
+
#####################################
@@ -579,9 +608,10 @@ WeatherAsHtmlH($)
define Forecast Weather 673513 1800
- The module provides three additional functions WeatherAsHtml
, WeatherAsHtmlV
and
- WeatherAsHtmlH
. The former two functions are identical: they return the HTML code for a
- vertically arranged weather forecast. The latter returns the HTML code for a horizontally arranged weather forecast.
+ The module provides four additional functions WeatherAsHtml
, WeatherAsHtmlV
, WeatherAsHtmlH
and
+ WeatherAsHtmlD
. The former two functions are identical: they return the HTML code for a
+ vertically arranged weather forecast. The third function returns the HTML code for a horizontally arranged weather forecast. The
+ latter function dynamically picks the orientation depending on wether a smallscreen style is set (vertical layout) or not (horizontal layout).
Example:
define MyWeatherWeblink weblink htmlCode { WeatherAsHtmlH("MyWeather") }