From 4b475f469e659415694ea6c43a21ffb6a60d06b2 Mon Sep 17 00:00:00 2001 From: dietmar63 <> Date: Wed, 18 Jun 2014 19:08:58 +0000 Subject: [PATCH] Twilight: immediate update of readings after definition git-svn-id: https://svn.fhem.de/fhem/trunk@6136 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/59_Twilight.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/59_Twilight.pm b/fhem/FHEM/59_Twilight.pm index 7fd17637f..7f985604b 100644 --- a/fhem/FHEM/59_Twilight.pm +++ b/fhem/FHEM/59_Twilight.pm @@ -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($)