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 warnings;
|
||||||
use POSIX;
|
use POSIX;
|
||||||
use HttpUtils;
|
use HttpUtils;
|
||||||
|
use Math::Trig;
|
||||||
|
|
||||||
sub Twilight_calc($$$$$$$);
|
sub Twilight_calc($$$$$$$);
|
||||||
sub Twilight_getWeatherHorizon($);
|
sub Twilight_getWeatherHorizon($);
|
||||||
@ -282,24 +283,21 @@ Twilight_GetUpdate($)
|
|||||||
sub
|
sub
|
||||||
Twilight_calc($$$$$$$)
|
Twilight_calc($$$$$$$)
|
||||||
{
|
{
|
||||||
my ($latitude, $longitude, $horizon, $declination,
|
my ($latitude, $longitude, $horizon, $declination, $timezone, $midseconds, $timediff) = @_;
|
||||||
$timezone, $midseconds, $timediff) = @_;
|
|
||||||
my $suntime=0;
|
my $s1 = sin($horizon /57.29578);
|
||||||
my $sunrise=0;
|
my $s2 = sin($latitude/57.29578) * sin($declination);
|
||||||
my $sunset=0;
|
my $s3 = cos($latitude/57.29578) * cos($declination);
|
||||||
eval {
|
|
||||||
$suntime = 12*acos((sin($horizon/57.29578) -
|
my ($suntime, $sunrise, $sunset);
|
||||||
sin($latitude/57.29578) * sin($declination)) /
|
my $acosArg = ($s1 - $s2) / $s3;
|
||||||
(cos($latitude/57.29578)*cos($declination))) /
|
if (abs($acosArg) < 1.0) { # ok
|
||||||
3.141592 ;
|
$suntime = 12*acos($acosArg)/pi;
|
||||||
$sunrise = $midseconds +
|
$sunrise = $midseconds + (12-$timediff -$suntime -$longitude/15+$timezone) * 3600;
|
||||||
(12-$timediff -$suntime -$longitude/15+$timezone) *
|
$sunset = $midseconds + (12-$timediff +$suntime -$longitude/15+$timezone) * 3600;
|
||||||
3600;
|
} else {
|
||||||
$sunset = $midseconds +
|
$sunrise = $sunset = "nan";
|
||||||
(12-$timediff +$suntime -$longitude/15+$timezone) *
|
}
|
||||||
3600;
|
|
||||||
};
|
|
||||||
$sunrise = $sunset = "nan" if($@);
|
|
||||||
return $sunrise, $sunset;
|
return $sunrise, $sunset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +313,7 @@ Twilight_getWeatherHorizon($)
|
|||||||
# yahoo weather API
|
# yahoo weather API
|
||||||
my $location=$hash->{WEATHER};
|
my $location=$hash->{WEATHER};
|
||||||
my $xml = GetFileFromURL("http://weather.yahooapis.com/forecastrss?w=".
|
my $xml = GetFileFromURL("http://weather.yahooapis.com/forecastrss?w=".
|
||||||
$location."&u=c",4.0);
|
$location."&u=c",4.0, undef, 1);
|
||||||
my $current;
|
my $current;
|
||||||
if($xml=~/code="(.*)"(\ *)temp/){
|
if($xml=~/code="(.*)"(\ *)temp/){
|
||||||
if(defined($1)){
|
if(defined($1)){
|
||||||
@ -329,8 +327,9 @@ Twilight_getWeatherHorizon($)
|
|||||||
return 1;
|
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->{WEATHER_HORIZON}="0";
|
||||||
$hash->{CONDITION}="-1";
|
$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/56_POKEYS.pm axelberner http://forum.fhem.de Sonstiges
|
||||||
FHEM/57_Calendar.pm borisneubert 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_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/59_Weather.pm borisneubert http://forum.fhem.de Sonstiges
|
||||||
FHEM/60_EM.pm rudolfkoenig http://forum.fhem.de SlowRF
|
FHEM/60_EM.pm rudolfkoenig http://forum.fhem.de SlowRF
|
||||||
FHEM/61_EMWZ.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/95_holiday.pm rudolfkoenig http://forum.fhem.de Sonstiges
|
||||||
FHEM/98_CULflash.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_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_JsonList.pm mfr69b http://forum.fhem.de Automatisierung
|
||||||
FHEM/98_PID.pm rudolfkoenig 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
|
FHEM/98_SVG.pm rudolfkoenig http://forum.fhem.de Frontends
|
||||||
|
Loading…
x
Reference in New Issue
Block a user