mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
90_at.pm: fix onetime at after reboot (Forum #44819)
git-svn-id: https://svn.fhem.de/fhem/trunk@10035 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7596515649
commit
cc412566e6
@ -124,8 +124,13 @@ at_Define($$)
|
|||||||
return $ret if($ret);
|
return $ret if($ret);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
my $fmt = FmtDateTime($nt);
|
||||||
$hash->{TRIGGERTIME} = $nt;
|
$hash->{TRIGGERTIME} = $nt;
|
||||||
$hash->{TRIGGERTIME_FMT} = FmtDateTime($nt);
|
$hash->{TRIGGERTIME_FMT} = $fmt;
|
||||||
|
if($hash->{PERIODIC} eq "no") { # Need for restart
|
||||||
|
$fmt =~ s/ /T/;
|
||||||
|
$hash->{DEF} = $fmt." ".$hash->{COMMAND};
|
||||||
|
}
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
InternalTimer($nt, "at_Exec", $hash, 0);
|
InternalTimer($nt, "at_Exec", $hash, 0);
|
||||||
$hash->{NTM} = $ntm if($rel eq "+" || $fn);
|
$hash->{NTM} = $ntm if($rel eq "+" || $fn);
|
||||||
@ -295,25 +300,7 @@ at_State($$$$)
|
|||||||
|
|
||||||
if($vt eq "state" && $val eq "inactive") {
|
if($vt eq "state" && $val eq "inactive") {
|
||||||
readingsSingleUpdate($hash, "state", "inactive", 1);
|
readingsSingleUpdate($hash, "state", "inactive", 1);
|
||||||
return undef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef if($hash->{DEF} !~ m/^\+\d/ ||
|
|
||||||
$val !~ m/Next: (\d\d):(\d\d):(\d\d)/);
|
|
||||||
|
|
||||||
my ($h, $m, $s) = ($1, $2, $3);
|
|
||||||
my $then = ($h*60+$m)*60+$s;
|
|
||||||
my $now = time();
|
|
||||||
my @lt = localtime($now);
|
|
||||||
my $ntime = ($lt[2]*60+$lt[1])*60+$lt[0];
|
|
||||||
return undef if($ntime > $then);
|
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
|
||||||
RemoveInternalTimer($hash);
|
|
||||||
InternalTimer($now+$then-$ntime, "at_Exec", $hash, 0);
|
|
||||||
$hash->{NTM} = "$h:$m:$s";
|
|
||||||
$hash->{STATE} = $val;
|
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user