From 07d942bca2e55018e013c32903f3aeeff8e48d4b Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 11 Feb 2012 11:20:46 +0000 Subject: [PATCH] State for disabled fixed git-svn-id: https://svn.fhem.de/fhem/trunk@1246 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/90_at.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/90_at.pm b/fhem/FHEM/90_at.pm index 62bc97c43..e37a0c041 100755 --- a/fhem/FHEM/90_at.pm +++ b/fhem/FHEM/90_at.pm @@ -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; }