From c15a0da6c08ec611d13a92f9873a0144d2ac1e70 Mon Sep 17 00:00:00 2001 From: borisneubert Date: Thu, 1 Nov 2012 19:07:11 +0000 Subject: [PATCH] fix for negative temperatures git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@2049 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/59_Weather.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/59_Weather.pm b/fhem/FHEM/59_Weather.pm index d5f34f157..9fc29b78b 100755 --- a/fhem/FHEM/59_Weather.pm +++ b/fhem/FHEM/59_Weather.pm @@ -248,7 +248,7 @@ sub Weather_RetrieveData($) ### current condition if ($tag eq "yweather:condition" ) { - my $temp = (($value =~/temp="([0-9.]*?)".*/) ? $1 : undef); + my $temp = (($value =~/temp="(-?[0-9.]*?)".*/) ? $1 : undef); if ($temp) { readingsUpdate($hash, "temperature", $temp); readingsUpdate($hash, "temp_c", $temp); # compatibility @@ -267,9 +267,9 @@ sub Weather_RetrieveData($) ### 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); } - 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); } my $day1 = (($value =~/day="(.*?)" .*/) ? $1 : undef); # forecast if ($day1) { @@ -294,7 +294,7 @@ sub Weather_RetrieveData($) ### 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_direction", $2) if (defined($2)); my $windspeed= defined($3) ? int($3+0.5) : "";