diff --git a/fhem/FHEM/59_OPENWEATHER.pm b/fhem/FHEM/59_OPENWEATHER.pm index a503fed47..c675e6c37 100644 --- a/fhem/FHEM/59_OPENWEATHER.pm +++ b/fhem/FHEM/59_OPENWEATHER.pm @@ -83,6 +83,19 @@ sub text #Umlaute entfernen if ($curTag eq "w_txt") {$text =~ s/ö/oe/; $text =~ s/ä/ae/; $text =~ s/ü/ue/; $text =~ s/ß/ss/;} $fcReadings{"fc".$day."_".$rName.$time} = $text ; + # icon erzeugen + # if ($curTag eq "w") + # { + # if ($time != "23") + # { + # $fcReadings{"fc".$day."_".$rName.$time} = "d_".$text."_L.png" ; + # } + # else + # { + # $fcReadings{"fc".$day."_".$rName.$time} = "n_".$text."_L.png" ; + # } + # } + } } elsif ($curTag eq "d" && $time eq "") @@ -426,6 +439,48 @@ OPENWEATHER_UpdateAborted($) } # end OPENWEATHER_UpdateAborted +##### noch nicht fertig ########### +sub ##################################### +OPENWEATHER_Html($) +{ + my ($d) = @_; + $d = "" if(!$d); + return "$d is not a OPENWEATHER instance
" + if(!$defs{$d} || $defs{$d}{TYPE} ne "OPENWEATHER"); + + my $uselocal= 0; #AttrVal($d,"localicons",0); + my $isday; + if ( exists &isday) + { + $isday = isday(); + } + else + { + $isday = 1; #($hour>6 && $hour<19); + } + + my $ret = ""; + $ret .= sprintf '', ReadingsVal($d, "city", ""); + + for(my $i=0; $i<=2; $i++) + { + $ret .= sprintf('', + $i==0 ? "heute" : ReadingsVal($d, "fc".$i."_wday", "") + , ReadingsVal($d, "fc".$i."_weather", "") + , ReadingsVal($d, "fc".$i."_tempMin", ""), ReadingsVal($d, "fc".$i."_tempMax", "") + , ReadingsVal($d, "fc".$i."_chOfRain", "") + , ReadingsVal($d, "fc".$i."_wind", ""), ReadingsVal($d, "fc".$i."_windDirTxt", "") + ); + } + + $ret .= ""; + $ret .= "
Vorhersage %s
%s%s
min. %s °C max. %s °C
Niederschlagsrisiko: %s %
Wind: %s km/h aus %s
powered by wetter.com
"; + + return $ret; +} + +##################################### + 1; =pod @@ -468,6 +523,10 @@ OPENWEATHER_UpdateAborted($)
Secret key that is provided when the user creates a 'openweather' project on wetter.com.
+ The function OPENWEATHER_Html creates a HTML code for a vertically arranged weather forecast (in German). +
+ Example: define MyWeatherWeblink weblink htmlCode { OPENWEATHER_Html("MyWeather") } +

@@ -509,9 +568,9 @@ OPENWEATHER_UpdateAborted($)
  • fc0_tempMin06 - minimal temperatur today at 06:00 o'clock in °C
  • fc0_chOfRain - chance of rain today in % (pc)
  • fc0_valHours06 - validity period in hours of the forecast values starting at 06:00 o'clock (p)
  • -
  • fc0_weather - weather situation today (w_txt)
  • +
  • fc0_weather - weather situation today in German (w_txt)
  • fc0_weatherCode - code of weather situation today (w)
  • -
  • fc0_wday - week day of today (d)
  • +
  • fc0_wday - German abbreviation of week day of today (d)
  • fc0_wind - wind speed today in km/h (ws)
  • fc0_windDir - wind direction today in ° (degree) (wd)
  • fc0_windDirTxt - wind direction today in text form (wd_txt
  • @@ -561,6 +620,10 @@ OPENWEATHER_UpdateAborted($)
    Geheimer Schlüssel, den man erhält, nachdem man ein neues 'Openweather'-Projekt auf der Website registriert hat.
    + Über die Funktion OPENWEATHER_Html wird ein HTML-Code für ein vertikal arrangierte Wettervorhersage erzeugt. +
    + Beispiel: define MyWeatherWeblink weblink htmlCode { OPENWEATHER_Html("MyWeather") } +

    @@ -604,7 +667,7 @@ OPENWEATHER_UpdateAborted($)
  • fc0_valHours06 - Gültigkeitszeitraum der Prognose von heute ab 6:00 Uhr in Stunden (p)
  • fc0_weather - Wetterzustand heute (w_txt)
  • fc0_weatherCode - Code des Wetterzustand heute (w)
  • -
  • fc0_wday - Wochentag von heute (d)
  • +
  • fc0_wday - Abkürzung des Wochentags von heute (d)
  • fc0_wind - Windgeschwindigkeit heute in km/h (ws)
  • fc0_windDir - Windrichtung heute in ° (Grad) (wd)
  • fc0_windDirTxt - Windrichtung heute in Textform (wd_txt)