mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
RESIDENTStk.pm: revert commit 12011 and make more use of wakeupDefaultTime
git-svn-id: https://svn.fhem.de/fhem/trunk@12012 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2d28389009
commit
00ed2ad6b4
@ -868,23 +868,14 @@ sub RESIDENTStk_wakeupGetBegin($;$) {
|
|||||||
my $nextRun = ReadingsVal( $NAME, "nextRun", 0 );
|
my $nextRun = ReadingsVal( $NAME, "nextRun", 0 );
|
||||||
my $wakeupDefaultTime = AttrVal( $NAME, "wakeupDefaultTime", 0 );
|
my $wakeupDefaultTime = AttrVal( $NAME, "wakeupDefaultTime", 0 );
|
||||||
my $wakeupOffset = AttrVal( $NAME, "wakeupOffset", 0 );
|
my $wakeupOffset = AttrVal( $NAME, "wakeupOffset", 0 );
|
||||||
|
my $wakeupInitTime = ( $wakeupDefaultTime
|
||||||
|
&& lc($wakeupDefaultTime) ne "off" ? $wakeupDefaultTime : "05:00" );
|
||||||
my $wakeupTime;
|
my $wakeupTime;
|
||||||
|
|
||||||
if ($wakeupAtdevice) {
|
if ($wakeupAtdevice) {
|
||||||
|
|
||||||
# let at-device recalculate after global:INITIALIZED event
|
|
||||||
# as $nextRun can only be undef at that stage
|
|
||||||
if ( !$init_done ) {
|
|
||||||
Log3 $NAME, 4, "RESIDENTStk $NAME: Waiting for FHEM initialization to recalculate Wakeuptime";
|
|
||||||
InternalTimer( 1, RESIDENTStk_wakeupGetBegin,
|
|
||||||
( $NAME, $wakeupAtdevice ), 0 );
|
|
||||||
return "05:00";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Log3 $NAME, 4,
|
Log3 $NAME, 4,
|
||||||
"RESIDENTStk $NAME: Wakeuptime recalculation triggered by at-device $wakeupAtdevice";
|
"RESIDENTStk $NAME: Wakeuptime recalculation triggered by at-device $wakeupAtdevice";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# just give any valuable return to at-device
|
# just give any valuable return to at-device
|
||||||
# if wakeuptimer device does not exit anymore
|
# if wakeuptimer device does not exit anymore
|
||||||
@ -913,7 +904,7 @@ sub RESIDENTStk_wakeupGetBegin($;$) {
|
|||||||
"RESIDENTStk $NAME: Could not automatically clean up at-device, please perform manual cleanup.";
|
"RESIDENTStk $NAME: Could not automatically clean up at-device, please perform manual cleanup.";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "05:00";
|
return $wakeupInitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
# use nextRun value if not OFF
|
# use nextRun value if not OFF
|
||||||
@ -931,7 +922,7 @@ sub RESIDENTStk_wakeupGetBegin($;$) {
|
|||||||
|
|
||||||
# Use a default value to ensure auto-reset at least once a day
|
# Use a default value to ensure auto-reset at least once a day
|
||||||
else {
|
else {
|
||||||
$wakeupTime = "05:00";
|
$wakeupTime = $wakeupInitTime;
|
||||||
Log3 $NAME, 4, "RESIDENTStk $NAME: wakeupGetBegin source: defaultValue";
|
Log3 $NAME, 4, "RESIDENTStk $NAME: wakeupGetBegin source: defaultValue";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user