mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
99_SUNRISE_EL.pm: add lat/long as optional parameter to sr_alt (Forum #113722)
git-svn-id: https://svn.fhem.de/fhem/trunk@22774 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
14244b3d52
commit
7c65595bd3
@ -28,7 +28,7 @@ my $defaultaltit = "-6"; # Civil twilight
|
||||
my $RADEG = ( 180 / 3.1415926 );
|
||||
my $DEGRAD = ( 3.1415926 / 180 );
|
||||
my $INV360 = ( 1.0 / 360.0 );
|
||||
my %alti = (REAL => 0, CIVIL => -6, NAUTIC => -12, ASTRONOMIC => -16); # or HORIZON <number>
|
||||
my %alti = (REAL=>0, CIVIL=>-6, NAUTIC=>-12, ASTRONOMIC=>-16); # or HORIZON=<nr>
|
||||
|
||||
|
||||
sub
|
||||
@ -61,24 +61,29 @@ sr($$$$$$)
|
||||
}
|
||||
|
||||
sub
|
||||
sr_alt($$$$$$$$$)
|
||||
sr_alt($$$$$$$$$;$$)
|
||||
{
|
||||
my $nt=shift;
|
||||
my $rise=shift;
|
||||
my $isrel=shift;
|
||||
my $daycheck=shift;
|
||||
my $nextDay=shift;
|
||||
my $altit = defined($_[0]) ? $_[0] : "";
|
||||
if(exists $alti{uc($altit)}) {
|
||||
$altit=$alti{uc($altit)};
|
||||
shift;
|
||||
my $nt = shift;
|
||||
my $rise = shift;
|
||||
my $isrel = shift;
|
||||
my $daycheck= shift;
|
||||
my $nextDay = shift;
|
||||
my $altit = shift;
|
||||
my $seconds = shift;
|
||||
my $min = shift;
|
||||
my $max = shift;
|
||||
$lat = shift;
|
||||
$long = shift;
|
||||
|
||||
$altit = defined($altit) ? uc($altit) : "";
|
||||
if(exists $alti{$altit}) {
|
||||
$altit = $alti{$altit};
|
||||
} elsif($altit =~ /HORIZON=([\-\+]*[0-9\.]+)/i) {
|
||||
$altit=$1;
|
||||
shift;
|
||||
$altit=$1;
|
||||
} else {
|
||||
$altit=-6; #default
|
||||
$altit=-6; #default
|
||||
}
|
||||
my($seconds, $min, $max)=@_;
|
||||
|
||||
my $needrise = ($rise || $daycheck) ? 1 : 0;
|
||||
my $needset = (!$rise || $daycheck) ? 1 : 0;
|
||||
$seconds = 0 if(!$seconds);
|
||||
@ -87,8 +92,8 @@ sr_alt($$$$$$$$$)
|
||||
# If set in global, use longitude/latitude
|
||||
# from global, otherwise set Frankfurt/Germany as
|
||||
# default
|
||||
$long = AttrVal("global", "longitude", "8.686");
|
||||
$lat = AttrVal("global", "latitude", "50.112");
|
||||
$long = AttrVal("global", "longitude", "8.686") if(!defined($long));
|
||||
$lat = AttrVal("global", "latitude", "50.112") if(!defined($lat));
|
||||
Log3 undef, 5, "Compute sunrise/sunset for latitude $lat , longitude $long";
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user