mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
SetExtensions.pm: Fix the InternalTimer problems (Forum #95581)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19208 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
97dc658ab6
commit
e64681aa2f
@ -21,7 +21,7 @@ SetExtensionsCancel($)
|
|||||||
|
|
||||||
if($hash->{TIMED_OnOff}) { # on-for-timer, blink
|
if($hash->{TIMED_OnOff}) { # on-for-timer, blink
|
||||||
my $cmd = $hash->{TIMED_OnOff}{CMD};
|
my $cmd = $hash->{TIMED_OnOff}{CMD};
|
||||||
RemoveInternalTimer("SE $name $cmd");
|
RemoveInternalTimer($hash->{TIMED_OnOff});
|
||||||
delete $hash->{TIMED_OnOff};
|
delete $hash->{TIMED_OnOff};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,10 +122,11 @@ SetExtensions($$@)
|
|||||||
if($param) {
|
if($param) {
|
||||||
$hash->{TIMED_OnOff} = {
|
$hash->{TIMED_OnOff} = {
|
||||||
START=>time(), START_FMT=>TimeNow(), DURATION=>$param,
|
START=>time(), START_FMT=>TimeNow(), DURATION=>$param,
|
||||||
CMD=>$cmd, NEXTCMD=>$cmd2
|
CMD=>$cmd, NEXTCMD=>$cmd2, hash=>$hash
|
||||||
};
|
};
|
||||||
SE_DoSet($name, $cmd1);
|
SE_DoSet($name, $cmd1);
|
||||||
InternalTimer(gettimeofday()+$param,"SetExtensionsFn",$hash, 0);
|
InternalTimer(gettimeofday()+$param,
|
||||||
|
"SetExtensionsFn", $hash->{TIMED_OnOff}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} elsif($cmd =~ m/^(on|off)-till/) {
|
} elsif($cmd =~ m/^(on|off)-till/) {
|
||||||
@ -161,9 +162,11 @@ SetExtensions($$@)
|
|||||||
if($param) {
|
if($param) {
|
||||||
$hash->{TIMED_OnOff} = {
|
$hash->{TIMED_OnOff} = {
|
||||||
START=>time(), START_FMT=>TimeNow(), DURATION=>$param,
|
START=>time(), START_FMT=>TimeNow(), DURATION=>$param,
|
||||||
CMD=>$cmd, NEXTCMD=>"$cmd $param $p2 ".($a[2] ? "0" : "1")
|
CMD=>$cmd, NEXTCMD=>"$cmd $param $p2 ".($a[2] ? "0" : "1"),
|
||||||
|
hash=>$hash
|
||||||
};
|
};
|
||||||
InternalTimer(gettimeofday()+$p2, "SetExtensionsFn",$hash,0);
|
InternalTimer(gettimeofday()+$p2,
|
||||||
|
"SetExtensionsFn", $hash->{TIMED_OnOff}, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,8 +216,9 @@ SetExtensions($$@)
|
|||||||
sub
|
sub
|
||||||
SetExtensionsFn($)
|
SetExtensionsFn($)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($too) = @_;
|
||||||
return if(!$hash || !$hash->{TIMED_OnOff});
|
my $hash = $too->{hash};
|
||||||
|
return if(!$hash || !$defs{$hash->{NAME}}); # deleted
|
||||||
|
|
||||||
my $nextcmd = $hash->{TIMED_OnOff}{NEXTCMD};
|
my $nextcmd = $hash->{TIMED_OnOff}{NEXTCMD};
|
||||||
delete $hash->{TIMED_OnOff};
|
delete $hash->{TIMED_OnOff};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user