diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 891956aa1..41aea3d63 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -2873,7 +2873,7 @@ CommandAttr($$) @a = split(" ", $param, 3) if($param); return "Usage: attr [-a|-r] []\n$namedef" - if(@a < 2); + if(@a < 2 || ($append && $remove)); my $a1 = $a[1]; return "$a[0]: bad attribute name '$a1' (allowed chars: A-Za-z/\\d_\\.-)" if($featurelevel > 5.9 && !goodReadingName($a1) && $a1 ne "?"); @@ -2917,12 +2917,11 @@ CommandAttr($$) if($append && $attr{$sdev} && $attr{$sdev}{$attrName}) { $attrVal = $attr{$sdev}{$attrName} . ($attrVal =~ m/^,/ ? $attrVal : " $attrVal"); - - } elsif($remove && $attr{$sdev} && $attr{$sdev}{$attrName}) { + } + if($remove && $attr{$sdev} && $attr{$sdev}{$attrName}) { my $v = $attr{$sdev}{$attrName}; $v =~ s/\b$attrVal\b//; $attrVal = $v; - } if($attrName eq 'disable' && $attrVal eq 'toggle') {