2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

10_FS20.pm: fix follow-on-for-timer for non-integer duration (Forum #139149)

git-svn-id: https://svn.fhem.de/fhem/trunk@29139 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2024-09-10 18:32:52 +00:00
parent 66052d8a22
commit 95e785ffa6

View File

@ -161,12 +161,20 @@ FS20_Follow($$$$)
}
if($newState) {
my $to = sprintf("%02d:%02d:%02d", $val/3600, ($val%3600)/60, $val%60);
$modules{FS20}{ldata}{$name} = $to;
Log3 $name, 4, "Follow: +$to setstate $name $newState";
CommandDefine(undef, $name."_timer at +$to ".
"{readingsSingleUpdate(\$defs{'$name'},'state','$newState', 1);".
"delete \$defs{'$name'}->{TIMED_OnOff}; undef}");
if(int($val) == $val) {
my $to = sprintf("%02d:%02d:%02d", $val/3600, ($val%3600)/60, $val%60);
$modules{FS20}{ldata}{$name} = $to;
Log3 $name, 4, "Follow: +$to setstate $name $newState";
CommandDefine(undef, $name."_timer at +$to ".
"{readingsSingleUpdate(\$defs{'$name'},'state','$newState', 1);".
"delete \$defs{'$name'}->{TIMED_OnOff}; undef}");
} else {
Log3 $name, 4, "Follow: sleep $val; setstate $name $newState";
AnalyzeCommandChain(undef,
"sleep $val; setreading $name state $newState; ".
"{delete \$defs{'$name'}->{TIMED_OnOff};;undef}");
}
if($defs{$name}) {
$defs{$name}->{TIMED_OnOff} = {