mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-12 16:46:35 +00:00
Sprinkle.pm: add fix for schedule in past
git-svn-id: https://svn.fhem.de/fhem/trunk@5931 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
974b2272c8
commit
503a906aaf
@ -271,7 +271,7 @@ sub UpdateSprinkleControlList($$) {
|
||||
|
||||
foreach my $d (sort keys %defs) {
|
||||
if($defs{$d}{TYPE} eq "SprinkleControl") {
|
||||
push(@newlist, $d) unless(defined($hash) && ($d eq $hash->{NAME}) && ($cmd eq "del"))
|
||||
push(@newlist, $d) unless(defined($hash) && ($d eq $hash->{NAME}) && ($cmd eq "del"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,10 +285,14 @@ sub Sprinkle_InternalTimerDoIt(@) {
|
||||
my ($rel, $hr, $min, $sec) = ($1, $2, $3, $4);
|
||||
my @lt = localtime(time);
|
||||
my $nt = time;
|
||||
$nt -= ($lt[2]*3600+$lt[1]*60+$lt[0]) # Midnight for absolute time
|
||||
if($rel ne "+");
|
||||
$nt += ($hr*3600+$min*60+$sec); # Plus relative time
|
||||
|
||||
|
||||
if($rel ne "+") {
|
||||
$nt -= (($lt[2]*3600)+($lt[1]*60)+$lt[0]); # Midnight for absolute time
|
||||
$nt += 86400 if((($lt[2]*3600)+($lt[1]*60)+$lt[0]) >= (($hr*3600)+($min*60)+$sec)); # tomorrow is next time
|
||||
}
|
||||
|
||||
$nt += (($hr*3600)+($min*60)+$sec); # Plus relative time
|
||||
|
||||
@lt = localtime($nt);
|
||||
my $ntm = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]);
|
||||
$hash->{NextTime} = $ntm;
|
||||
@ -394,7 +398,7 @@ sub Sprinkle_DoIt($$) {
|
||||
if($oldState ne "on" && (($SprinkleControl && SprinkleControl_AllocateNewThread($SprinkleControl, $me, $cmd)) || !$SprinkleControl)) {
|
||||
fhem "set $device $OnCmdAdd $OnCmd";
|
||||
$doit = 1;
|
||||
} elsif ($oldState ne $newState) {
|
||||
} elsif($oldState ne $newState) {
|
||||
$newState = "Wait";
|
||||
$doit = 2;
|
||||
}
|
||||
@ -408,7 +412,6 @@ sub Sprinkle_DoIt($$) {
|
||||
}
|
||||
|
||||
readingsSingleUpdate($hash, "state", $newState, 1) if($doit >= 1);
|
||||
|
||||
return $newState;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user