2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 01:46:08 +00:00

RESIDENTStk wakeuptimer: use lastWakeup as indicator for wakeupWaitPeriod

git-svn-id: https://svn.fhem.de/fhem/trunk@10806 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2016-02-13 08:47:34 +00:00
parent 7c2cfecc29
commit bfce286448

View File

@ -942,8 +942,6 @@ sub RESIDENTStk_wakeupRun($;$) {
my $wakeupWaitPeriod = AttrVal( $NAME, "wakeupWaitPeriod", 360 ); my $wakeupWaitPeriod = AttrVal( $NAME, "wakeupWaitPeriod", 360 );
my $holidayDevice = AttrVal( "global", "holiday2we", 0 ); my $holidayDevice = AttrVal( "global", "holiday2we", 0 );
my $lastRun = ReadingsVal( $NAME, "lastRun", "06:00" ); my $lastRun = ReadingsVal( $NAME, "lastRun", "06:00" );
my $lastRunTimestamp =
ReadingsTimestamp( $NAME, "lastRun", "1970-01-01 00:00:00" );
my $nextRun = ReadingsVal( $NAME, "nextRun", "06:00" ); my $nextRun = ReadingsVal( $NAME, "nextRun", "06:00" );
my $wakeupUserdeviceState = ReadingsVal( $wakeupUserdevice, "state", 0 ); my $wakeupUserdeviceState = ReadingsVal( $wakeupUserdevice, "state", 0 );
my $wakeupUserdeviceWakeup = ReadingsVal( $wakeupUserdevice, "wakeup", 0 ); my $wakeupUserdeviceWakeup = ReadingsVal( $wakeupUserdevice, "wakeup", 0 );
@ -1081,8 +1079,11 @@ sub RESIDENTStk_wakeupRun($;$) {
# general conditions to trigger program fulfilled # general conditions to trigger program fulfilled
else { else {
my $expLastRun = my $expLastRun = time_str2num(
time_str2num($lastRunTimestamp) - 1 + ReadingsTimestamp(
$wakeupUserdevice, "lastWakeup", "1970-01-01 00:00:00"
)
) - 1 +
$wakeupOffset * 60 + $wakeupOffset * 60 +
$wakeupWaitPeriod * 60; $wakeupWaitPeriod * 60;
@ -1102,7 +1103,7 @@ sub RESIDENTStk_wakeupRun($;$) {
} }
elsif ( $expLastRun > $nowRunSec && !$forceRun ) { elsif ( $expLastRun > $nowRunSec && !$forceRun ) {
Log3 $NAME, 4, Log3 $NAME, 4,
"RESIDENTStk $NAME: won't trigger wake-up program due to non-expired wakeupWaitPeriod threshold since lastRun (expLastRun=$expLastRun > nowRunSec=$nowRunSec)"; "RESIDENTStk $NAME: won't trigger wake-up program due to non-expired wakeupWaitPeriod threshold since lastWakeup (expLastRun=$expLastRun > nowRunSec=$nowRunSec)";
} }
else { else {
# conditional enforced wake-up: # conditional enforced wake-up: