fix for negative temperatures

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2049 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert
2012-11-01 19:07:11 +00:00
parent 872f582f04
commit f37c0980a6

View File

@@ -248,7 +248,7 @@ sub Weather_RetrieveData($)
### current condition ### current condition
if ($tag eq "yweather:condition" ) { if ($tag eq "yweather:condition" ) {
my $temp = (($value =~/temp="([0-9.]*?)".*/) ? $1 : undef); my $temp = (($value =~/temp="(-?[0-9.]*?)".*/) ? $1 : undef);
if ($temp) { if ($temp) {
readingsUpdate($hash, "temperature", $temp); readingsUpdate($hash, "temperature", $temp);
readingsUpdate($hash, "temp_c", $temp); # compatibility readingsUpdate($hash, "temp_c", $temp); # compatibility
@@ -267,9 +267,9 @@ sub Weather_RetrieveData($)
### forecast ### forecast
if ($tag eq "yweather:forecast" ) { if ($tag eq "yweather:forecast" ) {
my $low_c = (($value =~/low="([0-9.]*?)".*/) ? $1 : undef); my $low_c = (($value =~/low="(-?[0-9.]*?)".*/) ? $1 : undef);
if ($low_c) { readingsUpdate($hash, $prefix . "low_c", $low_c); } if ($low_c) { readingsUpdate($hash, $prefix . "low_c", $low_c); }
my $high_c = (($value =~/high="([0-9.]*?)".*/) ? $1 : undef); my $high_c = (($value =~/high="(-?[0-9.]*?)".*/) ? $1 : undef);
if ($high_c) { readingsUpdate($hash, $prefix . "high_c", $high_c); } if ($high_c) { readingsUpdate($hash, $prefix . "high_c", $high_c); }
my $day1 = (($value =~/day="(.*?)" .*/) ? $1 : undef); # forecast my $day1 = (($value =~/day="(.*?)" .*/) ? $1 : undef); # forecast
if ($day1) { if ($day1) {
@@ -294,7 +294,7 @@ sub Weather_RetrieveData($)
### wind ### wind
if ($tag eq "yweather:wind" ) { if ($tag eq "yweather:wind" ) {
$value =~/chill="([0-9.]*?)" .*direction="([0-9.]*?)" .*speed="([0-9.]*?)" .*/; $value =~/chill="(-?[0-9.]*?)" .*direction="([0-9.]*?)" .*speed="([0-9.]*?)" .*/;
readingsUpdate($hash, "wind_chill", $1) if (defined($1)); readingsUpdate($hash, "wind_chill", $1) if (defined($1));
readingsUpdate($hash, "wind_direction", $2) if (defined($2)); readingsUpdate($hash, "wind_direction", $2) if (defined($2));
my $windspeed= defined($3) ? int($3+0.5) : ""; my $windspeed= defined($3) ? int($3+0.5) : "";