diff --git a/fhem/CHANGED b/fhem/CHANGED
index 15e078291..d5d94fd07 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
+ - feature: 98_monitoring: whitelist attribute added
- feature: 93_DbRep: support of primary key (set in table history/current)
- update: 88_HMCCU: Optimized reading update performance
- feature: 00_SONOS: New lists for groupinformations
diff --git a/fhem/FHEM/98_monitoring.pm b/fhem/FHEM/98_monitoring.pm
index a992b74ec..af1be46ee 100644
--- a/fhem/FHEM/98_monitoring.pm
+++ b/fhem/FHEM/98_monitoring.pm
@@ -51,8 +51,8 @@ sub monitoring_Initialize($) {
$hash->{AttrFn} = $TYPE."_Attr";
$hash->{NotifyFn} = $TYPE."_Notify";
- $hash->{AttrList} =
- "addStateEvent:1,0 "
+ $hash->{AttrList} = ""
+ . "addStateEvent:1,0 "
. "blacklist "
. "disable:1,0 "
. "disabledForIntervals "
@@ -66,6 +66,7 @@ sub monitoring_Initialize($) {
. "warningFuncRemove:textField-long "
. "warningWait "
. "warningReturn:textField-long "
+ . "whitelist "
. $readingFnAttributes
;
}
@@ -193,7 +194,7 @@ sub monitoring_Attr(@) {
my ($cmd, $SELF, $attribute, $value) = @_;
my ($hash) = $defs{$SELF};
- if($attribute eq "blacklist" && $value){
+ if($attribute =~ "blacklist" && $value){
my @blacklist;
push(@blacklist, devspec2array($_)) foreach (split(" ", $value));
@@ -205,6 +206,18 @@ sub monitoring_Attr(@) {
monitoring_modify("$SELF|error|remove|$name");
}
}
+ elsif($attribute eq "whitelist" && $value){
+ my @whitelist;
+
+ push(@whitelist, devspec2array($_)) foreach (split(" ", $value));
+
+ foreach my $list ("warning", "error"){
+ foreach my $name (split(",", ReadingsVal($SELF, $list, ""))){
+ monitoring_modify("$SELF|$list|remove|$name")
+ unless(grep(/$name/, @whitelist));
+ }
+ }
+ }
elsif($attribute eq "disable"){
if($cmd eq "set" and $value == 1){
monitoring_setActive($hash);
@@ -254,6 +267,13 @@ sub monitoring_Notify($$) {
return if(@blacklist && grep(/$name/, @blacklist));
+ my @whitelist;
+
+ push(@whitelist, devspec2array($_))
+ foreach (split(" ", AttrVal($SELF, "whitelist", "")));
+
+ return if(@whitelist && !(grep(/$name/, @whitelist)));
+
foreach my $event (@{$events}){
my $addMatch = "$name:$event" =~ $addRegex;
my $removeMatch = $removeRegex ? "$name:$event" =~ $removeRegex : 0;
@@ -730,6 +750,12 @@ sub monitoring_setActive($) {
warningReturn {<perl code>}
Like errorReturn, just for the warning list.
+
whitelist {<perl code>}
readingFnAttributes
@@ -1197,6 +1223,13 @@ attr BeamerFilter_monitoring warningFuncRemove {return}
warningReturn {<perl code>}
whitelist {<perl code>}
readingFnAttributes