mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
bugfixing on Twilight
- calling GetFileFromUrl with noshutdown=1 just like in Weather.pm - computing arcusCosisnus only when parameter between [-1,+1] else returning "nan" not a Number - updating MAINTAINER.txt git-svn-id: https://svn.fhem.de/fhem/trunk@3273 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5560c5854b
commit
d8e5e137fe
@ -28,6 +28,7 @@ use strict;
|
||||
use warnings;
|
||||
use POSIX;
|
||||
use HttpUtils;
|
||||
use Math::Trig;
|
||||
|
||||
sub Twilight_calc($$$$$$$);
|
||||
sub Twilight_getWeatherHorizon($);
|
||||
@ -282,24 +283,21 @@ Twilight_GetUpdate($)
|
||||
sub
|
||||
Twilight_calc($$$$$$$)
|
||||
{
|
||||
my ($latitude, $longitude, $horizon, $declination,
|
||||
$timezone, $midseconds, $timediff) = @_;
|
||||
my $suntime=0;
|
||||
my $sunrise=0;
|
||||
my $sunset=0;
|
||||
eval {
|
||||
$suntime = 12*acos((sin($horizon/57.29578) -
|
||||
sin($latitude/57.29578) * sin($declination)) /
|
||||
(cos($latitude/57.29578)*cos($declination))) /
|
||||
3.141592 ;
|
||||
$sunrise = $midseconds +
|
||||
(12-$timediff -$suntime -$longitude/15+$timezone) *
|
||||
3600;
|
||||
$sunset = $midseconds +
|
||||
(12-$timediff +$suntime -$longitude/15+$timezone) *
|
||||
3600;
|
||||
};
|
||||
$sunrise = $sunset = "nan" if($@);
|
||||
my ($latitude, $longitude, $horizon, $declination, $timezone, $midseconds, $timediff) = @_;
|
||||
|
||||
my $s1 = sin($horizon /57.29578);
|
||||
my $s2 = sin($latitude/57.29578) * sin($declination);
|
||||
my $s3 = cos($latitude/57.29578) * cos($declination);
|
||||
|
||||
my ($suntime, $sunrise, $sunset);
|
||||
my $acosArg = ($s1 - $s2) / $s3;
|
||||
if (abs($acosArg) < 1.0) { # ok
|
||||
$suntime = 12*acos($acosArg)/pi;
|
||||
$sunrise = $midseconds + (12-$timediff -$suntime -$longitude/15+$timezone) * 3600;
|
||||
$sunset = $midseconds + (12-$timediff +$suntime -$longitude/15+$timezone) * 3600;
|
||||
} else {
|
||||
$sunrise = $sunset = "nan";
|
||||
}
|
||||
return $sunrise, $sunset;
|
||||
}
|
||||
|
||||
@ -315,7 +313,7 @@ Twilight_getWeatherHorizon($)
|
||||
# yahoo weather API
|
||||
my $location=$hash->{WEATHER};
|
||||
my $xml = GetFileFromURL("http://weather.yahooapis.com/forecastrss?w=".
|
||||
$location."&u=c",4.0);
|
||||
$location."&u=c",4.0, undef, 1);
|
||||
my $current;
|
||||
if($xml=~/code="(.*)"(\ *)temp/){
|
||||
if(defined($1)){
|
||||
@ -329,8 +327,9 @@ Twilight_getWeatherHorizon($)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Log 1, "[TWILIGHT] No Weather location found at yahoo weather ".
|
||||
"for location ID: $location";
|
||||
|
||||
Log 1, "[TWILIGHT] No Weather location found at yahoo weather for location ID: $location\nxml:\n$xml";
|
||||
|
||||
$hash->{WEATHER_HORIZON}="0";
|
||||
$hash->{CONDITION}="-1";
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ FHEM/50_WS300.pm tdressler http://forum.fhem.de SlowRF
|
||||
FHEM/56_POKEYS.pm axelberner http://forum.fhem.de Sonstiges
|
||||
FHEM/57_Calendar.pm borisneubert http://forum.fhem.de Sonstiges
|
||||
FHEM/59_HCS.pm mfr69bs http://forum.fhem.de Automatisierung
|
||||
FHEM/59_Twilight.pm unimatrix27 http://forum.fhem.de Sonstiges
|
||||
FHEM/59_Twilight.pm dietmar63 http://forum.fhem.de Unterstützende Dienste
|
||||
FHEM/59_Weather.pm borisneubert http://forum.fhem.de Sonstiges
|
||||
FHEM/60_EM.pm rudolfkoenig http://forum.fhem.de SlowRF
|
||||
FHEM/61_EMWZ.pm rudolfkoenig http://forum.fhem.de SlowRF
|
||||
@ -144,7 +144,7 @@ FHEM/95_PachLog.pm rudolfkoenig/orphan http://forum.fhem.de Sonstiges
|
||||
FHEM/95_holiday.pm rudolfkoenig http://forum.fhem.de Sonstiges
|
||||
FHEM/98_CULflash.pm rudolfkoenig http://forum.fhem.de Sonstiges
|
||||
FHEM/98_HMinfo.pm martinp876 http://forum.fhem.de Sonstiges
|
||||
FHEM/98_Heating_Control.pm dietmar63 http://forum.fhem.de Sonstiges
|
||||
FHEM/98_Heating_Control.pm dietmar63 http://forum.fhem.de Unterstützende Dienste
|
||||
FHEM/98_JsonList.pm mfr69b http://forum.fhem.de Automatisierung
|
||||
FHEM/98_PID.pm rudolfkoenig http://forum.fhem.de Automatisierung
|
||||
FHEM/98_SVG.pm rudolfkoenig http://forum.fhem.de Frontends
|
||||
|
Loading…
x
Reference in New Issue
Block a user