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

RESIDENTStk wakeuptimer: add lastAwake as 2nd indicator for wakeupWaitPeriod

git-svn-id: https://svn.fhem.de/fhem/trunk@10807 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2016-02-13 08:59:18 +00:00
parent bfce286448
commit 8973f7cd81

View File

@ -1079,7 +1079,7 @@ sub RESIDENTStk_wakeupRun($;$) {
# general conditions to trigger program fulfilled # general conditions to trigger program fulfilled
else { else {
my $expLastRun = time_str2num( my $expLastWakeup = time_str2num(
ReadingsTimestamp( ReadingsTimestamp(
$wakeupUserdevice, "lastWakeup", "1970-01-01 00:00:00" $wakeupUserdevice, "lastWakeup", "1970-01-01 00:00:00"
) )
@ -1087,6 +1087,13 @@ sub RESIDENTStk_wakeupRun($;$) {
$wakeupOffset * 60 + $wakeupOffset * 60 +
$wakeupWaitPeriod * 60; $wakeupWaitPeriod * 60;
my $expLastAwake = time_str2num(
ReadingsTimestamp(
$wakeupUserdevice, "lastAwake", "1970-01-01 00:00:00"
)
) - 1 +
$wakeupWaitPeriod * 60;
if ( !$wakeupMacro ) { if ( !$wakeupMacro ) {
return "$NAME: missing attribute wakeupMacro"; return "$NAME: missing attribute wakeupMacro";
} }
@ -1101,9 +1108,13 @@ sub RESIDENTStk_wakeupRun($;$) {
Log3 $NAME, 3, Log3 $NAME, 3,
"RESIDENTStk $NAME: Another wake-up program is already being executed for device $wakeupUserdevice, won't trigger $wakeupMacro"; "RESIDENTStk $NAME: Another wake-up program is already being executed for device $wakeupUserdevice, won't trigger $wakeupMacro";
} }
elsif ( $expLastRun > $nowRunSec && !$forceRun ) { elsif ( $expLastWakeup > $nowRunSec && !$forceRun ) {
Log3 $NAME, 4, Log3 $NAME, 3,
"RESIDENTStk $NAME: won't trigger wake-up program due to non-expired wakeupWaitPeriod threshold since lastWakeup (expLastRun=$expLastRun > nowRunSec=$nowRunSec)"; "RESIDENTStk $NAME: won't trigger wake-up program due to non-expired wakeupWaitPeriod threshold since lastWakeup (expLastWakeup=$expLastWakeup > nowRunSec=$nowRunSec)";
}
elsif ( $expLastAwake > $nowRunSec && !$forceRun ) {
Log3 $NAME, 3,
"RESIDENTStk $NAME: won't trigger wake-up program due to non-expired wakeupWaitPeriod threshold since lastAwake (expLastAwake=$expLastAwake > nowRunSec=$nowRunSec)";
} }
else { else {
# conditional enforced wake-up: # conditional enforced wake-up: