*** empty log message ***

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@1048 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2011-10-07 18:42:54 +00:00
parent ec381819b6
commit 226f25a507
3 changed files with 23 additions and 16 deletions

View File

@ -4,6 +4,7 @@
- feature: TCM120/TCM310 + EnOcean parser added - feature: TCM120/TCM310 + EnOcean parser added
- feature: eventMap enhanced - feature: eventMap enhanced
- bugfix: enabled logging for 59_Weather.pm (Boris) - bugfix: enabled logging for 59_Weather.pm (Boris)
- feature: language selection for 59_Weather.pm (Erwin)
- feature: .gplot files renamed from type to content - feature: .gplot files renamed from type to content
- bugfix: FS20 on-for-timer error reporting only in the logfile - bugfix: FS20 on-for-timer error reporting only in the logfile
- bugfix: FHEM2FHEM should work with CUL again, after syntax change - bugfix: FHEM2FHEM should work with CUL again, after syntax change

View File

@ -32,7 +32,6 @@ sub Weather_Initialize($) {
sub f_to_c($) { sub f_to_c($) {
my ($f)= @_; my ($f)= @_;
return int(($f-32)*5/9+0.5); return int(($f-32)*5/9+0.5);
} }
@ -42,17 +41,16 @@ sub Weather_UpdateReading($$$$$$) {
my ($hash,$prefix,$key,$tn,$value,$n)= @_; my ($hash,$prefix,$key,$tn,$value,$n)= @_;
return 0 if(!defined($value) || $value eq ""); return 0 if(!defined($value) || $value eq "");
return 0 if($key eq "unit_system");
if($key eq "temp") { if($key eq "temp") {
$key= "temp_c"; $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") { } elsif($key eq "low") {
$key= "low_c"; $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") { } elsif($key eq "high") {
$key= "high_c"; $key= "high_c";
$value= f_to_c($value); $value= f_to_c($value) if($hash->{READINGS}{unit_system}{VAL} ne "SI");
} }
my $reading= $prefix . $key; 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 # see http://search.cpan.org/~possum/Weather-Google-0.03/lib/Weather/Google.pm
my $location= $hash->{LOCATION}; my $location= $hash->{LOCATION};
my $lang= $hash->{LANG};
my $WeatherObj; my $WeatherObj;
Log 4, "$name: Updating weather information for $location."; Log 4, "$name: Updating weather information for $location, language $lang.";
eval { eval {
$WeatherObj= new Weather::Google($location); $WeatherObj= new Weather::Google($location, {language => $lang});
}; };
if($@) { if($@) {
Log 1, "$name: Could not retrieve weather information."; Log 1, "$name: Could not retrieve weather information.";
@ -165,18 +164,21 @@ sub Weather_Define($$) {
my @a = split("[ \t][ \t]*", $def); my @a = split("[ \t][ \t]*", $def);
return "syntax: define <name> Weather <location> [interval]" return "syntax: define <name> Weather <location> [interval [en|de|fr|es]]"
if(int(@a) < 3 && int(@a) > 4); if(int(@a) < 3 && int(@a) > 5);
$hash->{STATE} = "Initialized"; $hash->{STATE} = "Initialized";
my $name = $a[0]; my $name = $a[0];
my $location = $a[2]; my $location = $a[2];
my $interval = 3600; 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->{LOCATION} = $location;
$hash->{INTERVAL} = $interval; $hash->{INTERVAL} = $interval;
$hash->{LANG} = $lang;
$hash->{READINGS}{current_date_time}{TIME}= TimeNow(); $hash->{READINGS}{current_date_time}{TIME}= TimeNow();
$hash->{READINGS}{current_date_time}{VAL}= "none"; $hash->{READINGS}{current_date_time}{VAL}= "none";

View File

@ -3729,7 +3729,7 @@ A line ending with \ will be concatenated with the next one, so long lines
<a name="Weatherdefine"></a> <a name="Weatherdefine"></a>
<b>Define</b> <b>Define</b>
<ul> <ul>
<code>define &lt;name&gt; Weather &lt;location&gt; [&lt;interval&gt;]</code><br> <code>define &lt;name&gt; Weather &lt;location&gt; [&lt;interval&gt; [en|de|fr|es]]</code><br>
<br> <br>
Defines a virtual device for weather forecasts. You need to have the perl 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, 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
<code>http://www.google.de/ig/api?weather=location&hl=en</code> <code>http://www.google.de/ig/api?weather=location&hl=en</code>
to see the raw output for your location.<br><br> to see the raw output for your location.<br><br>
The parameter <code>interval</code> is the time between subsequent updates The optional parameter <code>interval</code> is the time between subsequent updates
in seconds. It defaults to 3600 (1 hour).<br><br> in seconds. It defaults to 3600 (1 hour).<br><br>
The optional language parameter may be one of <code>en</code>, <code>de</code>, <code>fr</code>,
<code>es</code>. 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.<br><br>
Examples: Examples:
<pre> <pre>
define MyWeather Weather "Frankfurt,HE" define MyWeather Weather "Frankfurt,HE"
define Forecast Weather "Amsterdam,NL" 1800 define Forecast Weather "Amsterdam,NL" 1800
define weather Weather "30000,France" define weather Weather "30000,France" 3600 fr
</pre> </pre>
</ul> </ul>
<br> <br>