2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 07:24:21 +00:00

State for disabled fixed

git-svn-id: https://svn.fhem.de/fhem/trunk@1246 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-02-11 11:20:46 +00:00
parent 188d24b16b
commit 07d942bca2

View File

@ -20,6 +20,7 @@ at_Initialize($)
my $at_tdiff;
my $oldattr;
#####################################
sub
@ -73,8 +74,7 @@ at_Define($$)
RemoveInternalTimer($name);
InternalTimer($nt, "at_Exec", $name, 0);
$hash->{STATE} = ("Next: " . FmtTime($nt))
if(!($attr{$name} && $attr{$name}{disable}));
$hash->{STATE} = ($oldattr && $oldattr->{disable} ? "disabled" : ("Next: ".FmtTime($nt)));
return undef;
}
@ -112,7 +112,7 @@ at_Exec($)
my $count = $defs{$name}{REP};
my $def = $defs{$name}{DEF};
my $oldattr = $attr{$name}; # delete removes the attributes too
$oldattr = $attr{$name}; # delete removes the attributes too
# Correct drift when the timespec is relative
$at_tdiff = $defs{$name}{TRIGGERTIME}-gettimeofday() if($def =~ m/^\+/);
@ -126,6 +126,7 @@ at_Exec($)
CommandDefine(undef, "$name at $def"); # Recompute the next TRIGGERTIME
delete($data{AT_RECOMPUTE});
$attr{$name} = $oldattr;
$oldattr = undef;
}
$at_tdiff = undef;
}
@ -141,10 +142,10 @@ at_Attr(@)
}
$do = 2 if($a[0] eq "del" && (!$a[2] || $a[2] eq "disable"));
return if(!$do);
$defs{$a[1]}{STATE} = ($do == 1 ?
"disabled" :
"Next: " . FmtTime($defs{$a[1]}{TRIGGERTIME}));
Log 1, "ATTR: $a[1] $defs{$a[1]}{STATE}";
return undef;
}