mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
59_Twilight.pm: correction when getting a timeout to the weather server parsing undefined xml string.
git-svn-id: https://svn.fhem.de/fhem/trunk@6905 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ac7827883e
commit
c561b1a06e
@ -432,6 +432,7 @@ sub Twilight_getWeatherHorizon($)
|
|||||||
my $xml = GetFileFromURL($url, 3, undef, 1);
|
my $xml = GetFileFromURL($url, 3, undef, 1);
|
||||||
|
|
||||||
my $current, my $cond, my $temp, my $aktTemp;
|
my $current, my $cond, my $temp, my $aktTemp;
|
||||||
|
if (defined($xml)) {
|
||||||
if($xml=~/text="(.*)"(\ *)code="(.*)"(\ *)temp="(.*)"(\ *)date/){
|
if($xml=~/text="(.*)"(\ *)code="(.*)"(\ *)temp="(.*)"(\ *)date/){
|
||||||
if(defined($1)){
|
if(defined($1)){
|
||||||
$cond =$1;
|
$cond =$1;
|
||||||
@ -440,6 +441,10 @@ sub Twilight_getWeatherHorizon($)
|
|||||||
}else{
|
}else{
|
||||||
$current=-1;
|
$current=-1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$current=-1;
|
||||||
|
}
|
||||||
|
|
||||||
if(($current>=0) && ($current <=47)) {
|
if(($current>=0) && ($current <=47)) {
|
||||||
$hash->{WEATHER_CORRECTION} = $a_current[$current] / 25 * 20;
|
$hash->{WEATHER_CORRECTION} = $a_current[$current] / 25 * 20;
|
||||||
@ -449,7 +454,6 @@ sub Twilight_getWeatherHorizon($)
|
|||||||
$hash->{TEMPERATUR} = $temp;
|
$hash->{TEMPERATUR} = $temp;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Log3 $hash, 3, "[$hash->{NAME}] "
|
Log3 $hash, 3, "[$hash->{NAME}] "
|
||||||
."No Weather location found at yahoo weather for location ID: $location\n"
|
."No Weather location found at yahoo weather for location ID: $location\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user