diff --git a/CHANGED b/CHANGED index aa3ec1353..83c11011c 100644 --- a/CHANGED +++ b/CHANGED @@ -4,12 +4,13 @@ - feature: TCM120/TCM310 + EnOcean parser added - feature: eventMap enhanced - bugfix: enabled logging for 59_Weather.pm (Boris) + - feature: language selection for 59_Weather.pm (Erwin) - feature: .gplot files renamed from type to content - bugfix: FS20 on-for-timer error reporting only in the logfile - bugfix: FHEM2FHEM should work with CUL again, after syntax change - feature: CUL directio mode (No Device::SerialPort needed) - feature: FritzBox 7270 ZIP file - + - 2011-07-08 (5.1) - feature: smallscreen optimizations for iPhone - feature: FHT8V rewrite (and moved from contrib into the FHEM directory). diff --git a/FHEM/59_Weather.pm b/FHEM/59_Weather.pm index 3afc063d0..41e0f2e68 100755 --- a/FHEM/59_Weather.pm +++ b/FHEM/59_Weather.pm @@ -32,7 +32,6 @@ sub Weather_Initialize($) { sub f_to_c($) { my ($f)= @_; - return int(($f-32)*5/9+0.5); } @@ -42,17 +41,16 @@ sub Weather_UpdateReading($$$$$$) { my ($hash,$prefix,$key,$tn,$value,$n)= @_; return 0 if(!defined($value) || $value eq ""); - return 0 if($key eq "unit_system"); - + if($key eq "temp") { $key= "temp_c"; - $value= f_to_c($value); + $value= f_to_c($value) if($hash->{READINGS}{unit_system}{VAL} ne "SI"); # assume F to C conversion required } elsif($key eq "low") { $key= "low_c"; - $value= f_to_c($value); + $value= f_to_c($value) if($hash->{READINGS}{unit_system}{VAL} ne "SI"); } elsif($key eq "high") { - $key= "high_c"; - $value= f_to_c($value); + $key= "high_c"; + $value= f_to_c($value) if($hash->{READINGS}{unit_system}{VAL} ne "SI"); } my $reading= $prefix . $key; @@ -93,10 +91,11 @@ sub Weather_GetUpdate($) # see http://search.cpan.org/~possum/Weather-Google-0.03/lib/Weather/Google.pm my $location= $hash->{LOCATION}; + my $lang= $hash->{LANG}; my $WeatherObj; - Log 4, "$name: Updating weather information for $location."; + Log 4, "$name: Updating weather information for $location, language $lang."; eval { - $WeatherObj= new Weather::Google($location); + $WeatherObj= new Weather::Google($location, {language => $lang}); }; if($@) { Log 1, "$name: Could not retrieve weather information."; @@ -165,18 +164,21 @@ sub Weather_Define($$) { my @a = split("[ \t][ \t]*", $def); - return "syntax: define Weather [interval]" - if(int(@a) < 3 && int(@a) > 4); + return "syntax: define Weather [interval [en|de|fr|es]]" + if(int(@a) < 3 && int(@a) > 5); $hash->{STATE} = "Initialized"; my $name = $a[0]; my $location = $a[2]; my $interval = 3600; - if(int(@a)==4) { $interval= $a[3]; } + my $lang = "en"; + if(int(@a)>=4) { $interval= $a[3]; } + if(int(@a)==5) { $lang= $a[4]; } $hash->{LOCATION} = $location; $hash->{INTERVAL} = $interval; + $hash->{LANG} = $lang; $hash->{READINGS}{current_date_time}{TIME}= TimeNow(); $hash->{READINGS}{current_date_time}{VAL}= "none"; diff --git a/docs/commandref.html b/docs/commandref.html index 8d2a03c72..a6c089bd5 100644 --- a/docs/commandref.html +++ b/docs/commandref.html @@ -3729,7 +3729,7 @@ A line ending with \ will be concatenated with the next one, so long lines Define
    - define <name> Weather <location> [<interval>]
    + define <name> Weather <location> [<interval> [en|de|fr|es]]

    Defines a virtual device for weather forecasts. You need to have the perl module Weather::Google installed to use this device. If you do not have it, @@ -3743,14 +3743,18 @@ A line ending with \ will be concatenated with the next one, so long lines http://www.google.de/ig/api?weather=location&hl=en to see the raw output for your location.

    - The parameter interval is the time between subsequent updates + The optional parameter interval is the time between subsequent updates in seconds. It defaults to 3600 (1 hour).

    + The optional language parameter may be one of en, de, fr, + es. It determines the natural language in which the forecast information appears. + It defaults to en. If you want to set the language you also have to set the interval.

    + Examples:
           define MyWeather Weather "Frankfurt,HE"
           define Forecast Weather "Amsterdam,NL" 1800
    -      define weather Weather "30000,France"
    +      define weather Weather "30000,France" 3600 fr