1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-07 22:29:19 +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->{LATITUDE} = $latitude;
$hash->{LONGITUDE} = $longitude; $hash->{LONGITUDE} = $longitude;
$hash->{WEATHER} = $weather; $hash->{WEATHER} = $weather;
$hash->{SUNPOS_OFFSET} = 1; $hash->{SUNPOS_OFFSET} = 5*60;
Twilight_sunposTimerSet($hash); my $mHash = { HASH=>$hash };
myRemoveInternalTimer("Midnight", $hash); Twilight_sunpos($mHash);
myInternalTimer ("Midnight", time()+1, "Twilight_Midnight", $hash, 0); Twilight_Midnight($mHash);
return undef; return undef;
} }
################################################################################ ################################################################################
@ -231,7 +232,7 @@ sub Twilight_TwilightTimes($$)
($hash->{TW}{$sr}{TIME}, $hash->{TW}{$ss}{TIME})= ($hash->{TW}{$sr}{TIME}, $hash->{TW}{$ss}{TIME})=
Twilight_calc($latitude, $longitude, $deg, $declination, $timezone, $midseconds, $timediff); 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}{$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"); $hash->{TW}{$ss}{TIME} -= 0.01*$idx if ($hash->{TW}{$ss}{TIME} ne "nan");
@ -343,7 +344,6 @@ sub Twilight_sunposTimerSet($) {
myRemoveInternalTimer ("sunpos", $hash); myRemoveInternalTimer ("sunpos", $hash);
myInternalTimer ("sunpos", time()+$hash->{SUNPOS_OFFSET}, "Twilight_sunpos", $hash, 0); myInternalTimer ("sunpos", time()+$hash->{SUNPOS_OFFSET}, "Twilight_sunpos", $hash, 0);
$hash->{SUNPOS_OFFSET} = 5*60;
} }
################################################################################ ################################################################################
sub Twilight_fireEvent($) sub Twilight_fireEvent($)