mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 19:04:20 +00:00
GetHttpFile now uses new Timeout Parameter
git-svn-id: https://svn.fhem.de/fhem/trunk@1432 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c247150e39
commit
5330211f52
@ -7,7 +7,6 @@
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Switch;
|
||||
use POSIX;
|
||||
|
||||
sub dayofyear {
|
||||
@ -266,13 +265,17 @@ sub Twilight_getWeatherHorizon{
|
||||
my @a_current = (25,25,25,25,20,10,10,10,10,10,10,7,7,7,5,10,10,6,6,6,10,6,6,6,6,6,6,5,5,3,3,0,0,0,0,7,0,15,15,15,9,15,8,5,12,6,8,8);
|
||||
#condition codes are described in FHEM wiki and in the documentation of the yahoo weather API
|
||||
my $location=shift;
|
||||
my $xml = GetHttpFile("weather.yahooapis.com:80","/forecastrss?w=".$location."&u=c");
|
||||
$xml=~/code="(.*)"(\ *)temp/;
|
||||
my $current=$1;
|
||||
if(($current>=0) && ($current <=47)) {
|
||||
return $a_current[$current];
|
||||
} else {
|
||||
return 1;
|
||||
my $xml = GetHttpFile("weather.yahooapis.com:80","/forecastrss?w=".$location."&u=c",4.0);
|
||||
my $current;
|
||||
if($xml=~/code="(.*)"(\ *)temp/){
|
||||
$current=$1;
|
||||
if(($current>=0) && ($current <=47)) {
|
||||
return $a_current[$current];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user