2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

avoiding to raise light events on startup of Twilight

git-svn-id: https://svn.fhem.de/fhem/trunk@3773 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dietmar63 2013-08-23 15:24:19 +00:00
parent fe71cb3530
commit 69ef4dd14d

View File

@ -1,4 +1,4 @@
# $Id$ # $Id
############################################################################## ##############################################################################
# #
# 59_Twilight.pm # 59_Twilight.pm
@ -356,6 +356,10 @@ sub Twilight_fireEvent($)
$nextEventTime = strftime("%H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})) if ($hash->{TW}{$nextEvent}{TIME} ne "nan"); $nextEventTime = strftime("%H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})) if ($hash->{TW}{$nextEvent}{TIME} ne "nan");
Log 3, "[".$hash->{NAME}."] " . sprintf ("%-10s state=%-2s light=%-2s nextEvent=%-10s %-14s deg=%+.1f°",$sx_name, $state, $light, $nextEvent, strftime("%d.%m.%Y %H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})), $deg); Log 3, "[".$hash->{NAME}."] " . sprintf ("%-10s state=%-2s light=%-2s nextEvent=%-10s %-14s deg=%+.1f°",$sx_name, $state, $light, $nextEvent, strftime("%d.%m.%Y %H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})), $deg);
my $eventTime = $hash->{TW}{$sx_name}{TIME};
my $now = time();
my $delta = abs ($now - $eventTime);
$hash->{STATE} = $state; $hash->{STATE} = $state;
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdate ($hash, "light", $light); readingsBulkUpdate ($hash, "light", $light);
@ -364,7 +368,9 @@ sub Twilight_fireEvent($)
readingsBulkUpdate ($hash, "nextEvent", $nextEvent); readingsBulkUpdate ($hash, "nextEvent", $nextEvent);
readingsBulkUpdate ($hash, "nextEventTime", $nextEventTime); readingsBulkUpdate ($hash, "nextEventTime", $nextEventTime);
readingsEndUpdate ($hash, defined($hash->{LOCAL} ? 0 : 1)); my $doNotTrigger = $hash->{LOCAL};
$doNotTrigger = $doNotTrigger || ($delta > 5);
readingsEndUpdate ($hash, !$doNotTrigger);
} }
# #