98_monitoring: blacklist attribute added

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@13742 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
igami 2017-03-20 04:56:51 +00:00
parent 33918a970c
commit f3bf8331bd

View File

@ -78,8 +78,6 @@ sub monitoring_Define($$) {
return("Usage: define <name> $TYPE <add-event> [<remove-event>]") return("Usage: define <name> $TYPE <add-event> [<remove-event>]")
if(int(@re) < 1 || int(@re) > 2); if(int(@re) < 1 || int(@re) > 2);
readingsBeginUpdate($hash);
readingsEndUpdate($hash, 0);
monitoring_setActive($hash) if($init_done); monitoring_setActive($hash) if($init_done);
return; return;
@ -140,7 +138,7 @@ sub monitoring_Set($@) {
unless(IsDisabled($SELF)); unless(IsDisabled($SELF));
readingsEndUpdate($hash, 0); readingsEndUpdate($hash, 0);
Log3($SELF, 2, "$SELF ($TYPE) set $SELF $argument $value"); Log3($SELF, 2, "$TYPE ($SELF) set $SELF $argument $value");
} }
elsif($argument =~ /^(error|warning)(Add|Remove)$/){ elsif($argument =~ /^(error|warning)(Add|Remove)$/){
monitoring_modify("$SELF|$1|".lc($2)."|$value"); monitoring_modify("$SELF|$1|".lc($2)."|$value");
@ -158,7 +156,7 @@ sub monitoring_Get($@) {
return("\"get $TYPE\" needs at least one argument") if(@a < 1); return("\"get $TYPE\" needs at least one argument") if(@a < 1);
my $argument = shift @a; my $argument = shift @a;
my $value = join(" ", @a) if (@a); my $value = join(" ", @a) if (@a);
my $default = AttrVal($SELF, "getDefault", "all"); my $default = AttrVal($SELF, "getDefault", "all");
my %monitoring_gets = ( my %monitoring_gets = (
"all" => "all:noArg" "all" => "all:noArg"
@ -201,7 +199,7 @@ sub monitoring_Attr(@) {
} }
else{ else{
readingsSingleUpdate($hash, "state", "disabled", 0); readingsSingleUpdate($hash, "state", "disabled", 0);
Log3($SELF, 3, "$SELF ($hash->{TYPE}) attr $SELF disabled"); Log3($SELF, 3, "$hash->{TYPE} ($SELF) attr $SELF disabled");
} }
} }
} }
@ -242,7 +240,7 @@ sub monitoring_Notify($$) {
next unless(defined($event) && ($addMatch || $removeMatch)); next unless(defined($event) && ($addMatch || $removeMatch));
Log3($SELF, 4 , "$SELF ($TYPE) triggered by \"$name $event\""); Log3($SELF, 4 , "$TYPE ($SELF) triggered by \"$name $event\"");
foreach my $list ("warning", "error"){ foreach my $list ("warning", "error"){
my $listFuncAdd = AttrVal($SELF, $list."FuncAdd", "preset"); my $listFuncAdd = AttrVal($SELF, $list."FuncAdd", "preset");
@ -252,21 +250,21 @@ sub monitoring_Notify($$) {
if($listFuncAdd eq "preset" && $listFuncRemove eq "preset"){ if($listFuncAdd eq "preset" && $listFuncRemove eq "preset"){
Log3($SELF, 5 Log3($SELF, 5
, "$SELF ($TYPE) " , "$TYPE ($SELF) "
. $list."FuncAdd and " . $list."FuncAdd and "
. $list."FuncRemove are preset" . $list."FuncRemove are preset"
); );
if(!$removeRegex){ if(!$removeRegex){
if($listWait == 0){ if($listWait == 0){
Log3($SELF, 2 Log3($SELF, 2
, "$SELF ($TYPE) set \"$list"."Wait\" while \"$list" , "$TYPE ($SELF) set \"$list"."Wait\" while \"$list"
. "FuncAdd\" and \"$list"."FuncRemove\" are same" . "FuncAdd\" and \"$list"."FuncRemove\" are same"
) if($list eq "error"); ) if($list eq "error");
next; next;
} }
Log3($SELF, 5, "$SELF ($TYPE) only addRegex is defined"); Log3($SELF, 5, "$TYPE ($SELF) only addRegex is defined");
monitoring_modify("$SELF|$list|remove|$name"); monitoring_modify("$SELF|$list|remove|$name");
monitoring_modify( monitoring_modify(
@ -279,7 +277,7 @@ sub monitoring_Notify($$) {
next unless($list eq "error" || AttrVal($SELF, "errorWait", undef)); next unless($list eq "error" || AttrVal($SELF, "errorWait", undef));
Log3($SELF, 5 Log3($SELF, 5
, "$SELF ($TYPE) addRegex ($addRegex) " , "$TYPE ($SELF) addRegex ($addRegex) "
. "and removeRegex ($removeRegex) are defined" . "and removeRegex ($removeRegex) are defined"
); );
@ -293,12 +291,12 @@ sub monitoring_Notify($$) {
$listFuncAdd = 1 if($listFuncAdd eq "preset" && $addMatch); $listFuncAdd = 1 if($listFuncAdd eq "preset" && $addMatch);
if(!$removeRegex){ if(!$removeRegex){
Log3($SELF, 5, "$SELF ($TYPE) only addRegex is defined"); Log3($SELF, 5, "$TYPE ($SELF) only addRegex is defined");
if($listFuncRemove eq "preset"){ if($listFuncRemove eq "preset"){
if($listWait == 0){ if($listWait == 0){
Log3($SELF, 2 Log3($SELF, 2
, "$SELF ($TYPE) set \"$list"."Wait\" while \"$list" , "$TYPE ($SELF) set \"$list"."Wait\" while \"$list"
. "FuncAdd\" and \"$list"."FuncRemove\" are same" . "FuncAdd\" and \"$list"."FuncRemove\" are same"
) if($list eq "error"); ) if($list eq "error");
@ -310,7 +308,7 @@ sub monitoring_Notify($$) {
} }
else{ else{
Log3($SELF, 5 Log3($SELF, 5
, "$SELF ($TYPE) addRegex ($addRegex) " , "$TYPE ($SELF) addRegex ($addRegex) "
. "and removeRegex ($removeRegex) are defined" . "and removeRegex ($removeRegex) are defined"
); );
@ -348,7 +346,7 @@ sub monitoring_modify($) {
my $reading = $list."Add_".$value; my $reading = $list."Add_".$value;
Log3( Log3(
$SELF, 5 , "$SELF ($TYPE)" $SELF, 5 , "$TYPE ($SELF)"
. "\n entering monitoring_modify" . "\n entering monitoring_modify"
. "\n reading: $list" . "\n reading: $list"
. "\n operation: $operation" . "\n operation: $operation"
@ -410,7 +408,7 @@ sub monitoring_setActive($) {
my $TYPE = $hash->{TYPE}; my $TYPE = $hash->{TYPE};
readingsSingleUpdate($hash, "state", "active", 0); readingsSingleUpdate($hash, "state", "active", 0);
Log3($SELF, 3, "$SELF ($TYPE) set $SELF active"); Log3($SELF, 3, "$TYPE ($SELF) set $SELF active");
foreach my $reading (sort(keys %{$hash->{READINGS}})){ foreach my $reading (sort(keys %{$hash->{READINGS}})){
if($reading =~ m/(error|warning)Add_(.+)/){ if($reading =~ m/(error|warning)Add_(.+)/){
@ -422,7 +420,7 @@ sub monitoring_setActive($) {
if($wait > 0){ if($wait > 0){
Log3($SELF, 4 Log3($SELF, 4
, "$SELF ($TYPE) restore Timer \"$SELF|$1|add|$2\"" , "$TYPE ($SELF) restore Timer \"$SELF|$1|add|$2\""
); );
} }
else{ else{