1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-04 22:19:38 +00:00

Twilight: immediate update of readings after definition

git-svn-id: https://svn.fhem.de/fhem/trunk@6136 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dietmar63 2014-06-18 19:08:58 +00:00
parent af9666e314
commit 4b475f469e

View File

@ -146,11 +146,12 @@ sub Twilight_Define($$)
$hash->{LATITUDE} = $latitude;
$hash->{LONGITUDE} = $longitude;
$hash->{WEATHER} = $weather;
$hash->{SUNPOS_OFFSET} = 1;
$hash->{SUNPOS_OFFSET} = 5*60;
Twilight_sunposTimerSet($hash);
myRemoveInternalTimer("Midnight", $hash);
myInternalTimer ("Midnight", time()+1, "Twilight_Midnight", $hash, 0);
my $mHash = { HASH=>$hash };
Twilight_sunpos($mHash);
Twilight_Midnight($mHash);
return undef;
}
################################################################################
@ -231,7 +232,7 @@ sub Twilight_TwilightTimes($$)
($hash->{TW}{$sr}{TIME}, $hash->{TW}{$ss}{TIME})=
Twilight_calc($latitude, $longitude, $deg, $declination, $timezone, $midseconds, $timediff);
Log3 $hash, 3, "$hash->{TW}{$sr}{NAME}, $hash->{TW}{$ss}{NAME} are not defined(nan)" if ($hash->{TW}{$sr}{TIME} eq "nan");
Log3 $hash, 4, "hint: $hash->{TW}{$sr}{NAME}, $hash->{TW}{$ss}{NAME} are not defined(nan)" if ($hash->{TW}{$sr}{TIME} eq "nan");
$hash->{TW}{$sr}{TIME} += 0.01*$idx if ($hash->{TW}{$sr}{TIME} ne "nan");
$hash->{TW}{$ss}{TIME} -= 0.01*$idx if ($hash->{TW}{$ss}{TIME} ne "nan");
@ -343,7 +344,6 @@ sub Twilight_sunposTimerSet($) {
myRemoveInternalTimer ("sunpos", $hash);
myInternalTimer ("sunpos", time()+$hash->{SUNPOS_OFFSET}, "Twilight_sunpos", $hash, 0);
$hash->{SUNPOS_OFFSET} = 5*60;
}
################################################################################
sub Twilight_fireEvent($)