Bugfix: attributes get deleted
git-svn-id: https://svn.fhem.de/fhem/trunk@293 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -81,24 +81,28 @@ at_Exec($)
|
|||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
my ($skip, $disable);
|
my ($skip, $disable);
|
||||||
|
|
||||||
|
return if(!$defs{$name}{DEF}); # Just deleted
|
||||||
|
|
||||||
if(defined($attr{$name})) {
|
if(defined($attr{$name})) {
|
||||||
$skip = 1 if($attr{$name} && $attr{$name}{skip_next});
|
$skip = 1 if($attr{$name} && $attr{$name}{skip_next});
|
||||||
$disable = 1 if($attr{$name} && $attr{$name}{disable});
|
$disable = 1 if($attr{$name} && $attr{$name}{disable});
|
||||||
}
|
}
|
||||||
|
|
||||||
delete $attr{$name}{skip_next} if($skip);
|
delete $attr{$name}{skip_next} if($skip);
|
||||||
return if(!$defs{$name}{DEF}); # Just deleted
|
|
||||||
my (undef, $command) = split("[ \t]+", $defs{$name}{DEF}, 2);
|
my (undef, $command) = split("[ \t]+", $defs{$name}{DEF}, 2);
|
||||||
$command = SemicolonEscape($command);
|
$command = SemicolonEscape($command);
|
||||||
AnalyzeCommandChain(undef, $command) if(!$skip && !$disable);
|
AnalyzeCommandChain(undef, $command) if(!$skip && !$disable);
|
||||||
|
|
||||||
my $count = $defs{$name}{REP};
|
my $count = $defs{$name}{REP};
|
||||||
my $def = $defs{$name}{DEF};
|
my $def = $defs{$name}{DEF};
|
||||||
|
|
||||||
|
my $oldattr = $attr{$name}; # delete removes the attributes too
|
||||||
CommandDelete(undef, $name); # Recreate ourselves
|
CommandDelete(undef, $name); # Recreate ourselves
|
||||||
|
|
||||||
if($count) {
|
if($count) {
|
||||||
$def =~ s/{\d+}/{$count}/ if($def =~ m/^\+?\*{/); # Replace the count }
|
$def =~ s/{\d+}/{$count}/ if($def =~ m/^\+?\*{/); # Replace the count }
|
||||||
CommandDefine(undef, "$name at $def"); # Recompute the next TRIGGERTIME
|
CommandDefine(undef, "$name at $def"); # Recompute the next TRIGGERTIME
|
||||||
|
$attr{$name} = $oldattr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user