mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-17 17:36:01 +00:00
Twilight - by omitting the yahooID the weaterinformation will not be read
git-svn-id: https://svn.fhem.de/fhem/trunk@6318 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
94efddb18a
commit
7d1ac5e2a5
@ -130,8 +130,8 @@ sub Twilight_Define($$)
|
||||
return "Argument Longitude is not a valid number";
|
||||
}
|
||||
|
||||
my $weather = "";
|
||||
my $indoor_horizon="4";
|
||||
my $weather = 0;
|
||||
my $indoor_horizon ="4";
|
||||
if(int(@a)>5) { $weather=$a[5] }
|
||||
if(int(@a)>4) { if ($a[4] =~ /^[\+-]*[0-9]*\.*[0-9]*$/ && $a[4] !~ /^[\. ]*$/ ) {
|
||||
$indoor_horizon = $a[4];
|
||||
@ -388,7 +388,7 @@ sub Twilight_calc($$$$$$$)
|
||||
{
|
||||
my ($latitude, $longitude, $horizon, $declination, $timezone, $midseconds, $timediff) = @_;
|
||||
|
||||
my $bogRad = 360/2/pi; # ~ 57.29578°
|
||||
my $bogRad = 360/2/pi; # ~ 57.29578°
|
||||
# $s1--| $s2-------------------| $s3---------------------|
|
||||
# Zeitdifferenz = 12*arccos((sin(h) - sin(B)*sin(Deklination)) / (cos(B)*cos(Deklination)))/Pi;
|
||||
my $s1 = sin($horizon /$bogRad);
|
||||
@ -412,6 +412,13 @@ sub Twilight_calc($$$$$$$)
|
||||
sub Twilight_getWeatherHorizon($)
|
||||
{
|
||||
my $hash=shift; # 0
|
||||
|
||||
my $location=$hash->{WEATHER};
|
||||
if ($location == 0) {
|
||||
$hash->{WEATHER_HORIZON}="0";
|
||||
$hash->{CONDITION}="0";
|
||||
return 1;
|
||||
}
|
||||
|
||||
my $mod = "[".$hash->{NAME} ."] ";
|
||||
my @a_current = (25,25,25,25,20,10,10,10,10,10,
|
||||
@ -421,7 +428,6 @@ sub Twilight_getWeatherHorizon($)
|
||||
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=$hash->{WEATHER};
|
||||
my $url = "http://weather.yahooapis.com/forecastrss?w=".$location."&u=c";
|
||||
my $xml = GetFileFromURL($url, 3, undef, 1);
|
||||
|
||||
@ -451,8 +457,8 @@ sub Twilight_getWeatherHorizon($)
|
||||
.$xml
|
||||
."\n=======";
|
||||
|
||||
$hash->{WEATHER_HORIZON}="0";
|
||||
$hash->{CONDITION}="-1";
|
||||
$hash->{WEATHER_HORIZON} = "0";
|
||||
$hash->{CONDITION} = "-1";
|
||||
}
|
||||
################################################################################
|
||||
sub Twilight_sunpos($)
|
||||
|
Loading…
x
Reference in New Issue
Block a user