mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 02:10:32 +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:
parent
7c2cfecc29
commit
bfce286448
@ -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 );
|
||||||
@ -971,11 +969,11 @@ sub RESIDENTStk_wakeupRun($;$) {
|
|||||||
|
|
||||||
$year += 1900;
|
$year += 1900;
|
||||||
$mon++;
|
$mon++;
|
||||||
$mon = "0" . $mon if ( $mon < 10 );
|
$mon = "0" . $mon if ( $mon < 10 );
|
||||||
$mday = "0" . $mday if ( $mday < 10 );
|
$mday = "0" . $mday if ( $mday < 10 );
|
||||||
$hour = "0" . $hour if ( $hour < 10 );
|
$hour = "0" . $hour if ( $hour < 10 );
|
||||||
$min = "0" . $min if ( $min < 10 );
|
$min = "0" . $min if ( $min < 10 );
|
||||||
$sec = "0" . $sec if ( $sec < 10 );
|
$sec = "0" . $sec if ( $sec < 10 );
|
||||||
|
|
||||||
my $nowRun = $hour . ":" . $min;
|
my $nowRun = $hour . ":" . $min;
|
||||||
my $nowRunSec =
|
my $nowRunSec =
|
||||||
@ -1081,10 +1079,13 @@ 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(
|
||||||
$wakeupOffset * 60 +
|
$wakeupUserdevice, "lastWakeup", "1970-01-01 00:00:00"
|
||||||
$wakeupWaitPeriod * 60;
|
)
|
||||||
|
) - 1 +
|
||||||
|
$wakeupOffset * 60 +
|
||||||
|
$wakeupWaitPeriod * 60;
|
||||||
|
|
||||||
if ( !$wakeupMacro ) {
|
if ( !$wakeupMacro ) {
|
||||||
return "$NAME: missing attribute wakeupMacro";
|
return "$NAME: missing attribute wakeupMacro";
|
||||||
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user