mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
Another try to fix the midsummer problem.
git-svn-id: https://svn.fhem.de/fhem/trunk@1621 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0dac5a502a
commit
0cd9f17fec
@ -192,10 +192,10 @@ sub Twilight_GetUpdate{
|
||||
($sunrise_set[$i]{RISE},$sunrise_set[$i]{SET})=
|
||||
twilight_calc($latitude,$longitude,$sunrise_set[$i]{DEGREE},$declination,$timezone,$midseconds,$timediff);
|
||||
readingsUpdate($hash, $sunrise_set[$i]{SR_NAME},
|
||||
$sunrise_set[$i]{RISE} eq "nan" ? "undefined" :
|
||||
$sunrise_set[$i]{RISE} eq "0" ? "undefined" :
|
||||
strftime("%H:%M:%S",localtime($sunrise_set[$i]{RISE})));
|
||||
readingsUpdate($hash, $sunrise_set[$i]{SS_NAME},
|
||||
$sunrise_set[$i]{SET} eq "nan" ? "undefined" :
|
||||
$sunrise_set[$i]{SET} eq "2000000000" ? "undefined" :
|
||||
strftime("%H:%M:%S",localtime($sunrise_set[$i]{SET})));
|
||||
}
|
||||
my $k=0;
|
||||
@ -204,7 +204,6 @@ sub Twilight_GetUpdate{
|
||||
my $licht;
|
||||
for(my $i=0;$i < 12;$i++){
|
||||
$nexttime=$sunrise_set[6-abs($i-6)-$k]{$half};
|
||||
next if($nexttime eq "undefined");
|
||||
if($nexttime > $now && $nexttime!=2000000000){
|
||||
readingsUpdate($hash,"light", 6-abs($i-6));
|
||||
if($i<6){
|
||||
@ -227,6 +226,7 @@ sub Twilight_GetUpdate{
|
||||
$hash->{STATE}=$i;
|
||||
last;
|
||||
}
|
||||
|
||||
if ($i == 5){
|
||||
$k=1;
|
||||
$half="SET";
|
||||
@ -264,6 +264,8 @@ sub twilight_calc {
|
||||
$sunrise=0;
|
||||
$sunset=2000000000;
|
||||
}
|
||||
$sunrise = 0 if($sunrise eq "nan");
|
||||
$sunset = 2000000000 if($sunset eq "nan");
|
||||
return $sunrise, $sunset;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user