From f37c0980a66d0447765a84bf77fd552f3225b171 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: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2049 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/59_Weather.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FHEM/59_Weather.pm b/FHEM/59_Weather.pm index d5f34f157..9fc29b78b 100755 --- a/FHEM/59_Weather.pm +++ b/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) : "";