diff --git a/fhem/FHEM/59_OPENWEATHER.pm b/fhem/FHEM/59_OPENWEATHER.pm index c675e6c37..993f5f50c 100644 --- a/fhem/FHEM/59_OPENWEATHER.pm +++ b/fhem/FHEM/59_OPENWEATHER.pm @@ -55,6 +55,7 @@ our $time = ""; , message => "errorMsg" , name => "city" , post_code => "postcode" + , url => "url" ); sub @@ -146,7 +147,7 @@ use LWP::UserAgent; use HTTP::Request; use HTML::Parser; - my $MODUL = "OPENWEATHER"; +my $MODUL = "OPENWEATHER"; sub OPENWEATHER_Log($$$); sub OPENWEATHER_Start($); @@ -191,7 +192,7 @@ OPENWEATHER_Define($$) my ($hash, $def) = @_; my @args = split("[ \t][ \t]*", $def); - return "Usage: define OPENWEATHER " if(@args <5 || @args >5); + return "Usage: define OPENWEATHER [language]" if(@args <5 || @args >6); my $name = $args[0]; my $interval = 3600; @@ -204,6 +205,7 @@ OPENWEATHER_Define($$) $hash->{PROJECT} = $args[2]; $hash->{CITYCODE} = $args[3]; $hash->{APIKEY} = $args[4]; + $hash->{LANGUAGE} = $args[5] if defined $args[5]; $hash->{CREDIT} = "Powered by wetter.com"; my $checkSum = md5_hex( $args[2] . $args[4] . $args[3] ); @@ -212,6 +214,7 @@ OPENWEATHER_Define($$) $URL .= '/city/' . $args[3]; $URL .= '/project/' . $args[2]; $URL .= '/cs/' . $checkSum; + $URL .= '/language/'. $args[5] if defined $args[5]; $hash->{URL} = $URL; @@ -305,7 +308,7 @@ OPENWEATHER_Get($@) if ($time > AttrVal($name, "timeOut", 10)) { $message = sprintf( "Runtime: %.2f s (!!! Increase attribute 'timeOut' !!!)\n_________________\n\n", $time) . $message; } else { - $message = sprintf( "Runtime: %.2f s\n_________________\n\n", $time) . $message; + $message = sprintf( "Response of %s\nRuntime: %.2f s\n_________________\n\n %s", $hash->{URL}, $time, $message); } return $message; @@ -500,7 +503,7 @@ OPENWEATHER_Html($) Define

    - define <name> OPENWEATHER <project> <cityCode> <apiKey> + define <name> OPENWEATHER <project> <cityCode> <apiKey> [language]
    Example:
    @@ -523,7 +526,11 @@ OPENWEATHER_Html($)
    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). +
  • [language] +
    + Optional. Default language of weather description is German. Change with en to English or es to Spanish. +

  • + The function OPENWEATHER_Html creates a HTML code for a vertically arranged weather forecast.
    Example: define MyWeatherWeblink weblink htmlCode { OPENWEATHER_Html("MyWeather") }

    @@ -598,7 +605,7 @@ OPENWEATHER_Html($) Define

      - define <name> OPENWEATHER <Projekt> <Ortscode> <apiSchlüssel> + define <name> OPENWEATHER <Projekt> <Ortscode> <apiSchlüssel> [Sprache]
      Beispiel:
      @@ -620,6 +627,10 @@ OPENWEATHER_Html($)
      Geheimer Schlüssel, den man erhält, nachdem man ein neues 'Openweather'-Projekt auf der Website registriert hat.
      +
    • [Sprache] +
      + Optional. Standardsprache für die Wettersituation ist Deutsch. Mit en kann man zu Englisch und mit es zu Spanisch wechseln. +

    • Über die Funktion OPENWEATHER_Html wird ein HTML-Code für ein vertikal arrangierte Wettervorhersage erzeugt.
      Beispiel: define MyWeatherWeblink weblink htmlCode { OPENWEATHER_Html("MyWeather") }