mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
added check if weather location is valid. if not, generate log entry and give meaningful values to readings
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@1481 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
358323bf55
commit
bb39885883
@ -270,18 +270,20 @@ sub Twilight_getWeatherHorizon{
|
|||||||
my $xml = GetHttpFile("weather.yahooapis.com:80","/forecastrss?w=".$location."&u=c",4.0);
|
my $xml = GetHttpFile("weather.yahooapis.com:80","/forecastrss?w=".$location."&u=c",4.0);
|
||||||
my $current;
|
my $current;
|
||||||
if($xml=~/code="(.*)"(\ *)temp/){
|
if($xml=~/code="(.*)"(\ *)temp/){
|
||||||
$current=$1;
|
if(defined($1)){
|
||||||
|
$current=$1;
|
||||||
|
}else{
|
||||||
|
$current=-1;
|
||||||
|
}
|
||||||
if(($current>=0) && ($current <=47)) {
|
if(($current>=0) && ($current <=47)) {
|
||||||
$hash->{WEATHER_HORIZON}=$a_current[$current]+$hash->{INDOOR_HORIZON};
|
$hash->{WEATHER_HORIZON}=$a_current[$current]+$hash->{INDOOR_HORIZON};
|
||||||
$hash->{CONDITION}=$current;
|
$hash->{CONDITION}=$current;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
return 0;
|
Log 1, "[TWILIGHT] No Weather location found at yahoo weather for location ID: $location";
|
||||||
}
|
$hash->{WEATHER_HORIZON}="0";
|
||||||
|
$hash->{CONDITION}="-1";
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user