mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 01:46:08 +00:00
98_monitoring: whitelist attribute added
git-svn-id: https://svn.fhem.de/fhem/trunk@13912 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
07afb9a5b8
commit
0c24546d65
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# 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)
|
- feature: 93_DbRep: support of primary key (set in table history/current)
|
||||||
- update: 88_HMCCU: Optimized reading update performance
|
- update: 88_HMCCU: Optimized reading update performance
|
||||||
- feature: 00_SONOS: New lists for groupinformations
|
- feature: 00_SONOS: New lists for groupinformations
|
||||||
|
@ -51,8 +51,8 @@ sub monitoring_Initialize($) {
|
|||||||
$hash->{AttrFn} = $TYPE."_Attr";
|
$hash->{AttrFn} = $TYPE."_Attr";
|
||||||
$hash->{NotifyFn} = $TYPE."_Notify";
|
$hash->{NotifyFn} = $TYPE."_Notify";
|
||||||
|
|
||||||
$hash->{AttrList} =
|
$hash->{AttrList} = ""
|
||||||
"addStateEvent:1,0 "
|
. "addStateEvent:1,0 "
|
||||||
. "blacklist "
|
. "blacklist "
|
||||||
. "disable:1,0 "
|
. "disable:1,0 "
|
||||||
. "disabledForIntervals "
|
. "disabledForIntervals "
|
||||||
@ -66,6 +66,7 @@ sub monitoring_Initialize($) {
|
|||||||
. "warningFuncRemove:textField-long "
|
. "warningFuncRemove:textField-long "
|
||||||
. "warningWait "
|
. "warningWait "
|
||||||
. "warningReturn:textField-long "
|
. "warningReturn:textField-long "
|
||||||
|
. "whitelist "
|
||||||
. $readingFnAttributes
|
. $readingFnAttributes
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -193,7 +194,7 @@ sub monitoring_Attr(@) {
|
|||||||
my ($cmd, $SELF, $attribute, $value) = @_;
|
my ($cmd, $SELF, $attribute, $value) = @_;
|
||||||
my ($hash) = $defs{$SELF};
|
my ($hash) = $defs{$SELF};
|
||||||
|
|
||||||
if($attribute eq "blacklist" && $value){
|
if($attribute =~ "blacklist" && $value){
|
||||||
my @blacklist;
|
my @blacklist;
|
||||||
|
|
||||||
push(@blacklist, devspec2array($_)) foreach (split(" ", $value));
|
push(@blacklist, devspec2array($_)) foreach (split(" ", $value));
|
||||||
@ -205,6 +206,18 @@ sub monitoring_Attr(@) {
|
|||||||
monitoring_modify("$SELF|error|remove|$name");
|
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"){
|
elsif($attribute eq "disable"){
|
||||||
if($cmd eq "set" and $value == 1){
|
if($cmd eq "set" and $value == 1){
|
||||||
monitoring_setActive($hash);
|
monitoring_setActive($hash);
|
||||||
@ -254,6 +267,13 @@ sub monitoring_Notify($$) {
|
|||||||
|
|
||||||
return if(@blacklist && grep(/$name/, @blacklist));
|
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}){
|
foreach my $event (@{$events}){
|
||||||
my $addMatch = "$name:$event" =~ $addRegex;
|
my $addMatch = "$name:$event" =~ $addRegex;
|
||||||
my $removeMatch = $removeRegex ? "$name:$event" =~ $removeRegex : 0;
|
my $removeMatch = $removeRegex ? "$name:$event" =~ $removeRegex : 0;
|
||||||
@ -730,6 +750,12 @@ sub monitoring_setActive($) {
|
|||||||
<code>warningReturn {<perl code>}</code><br>
|
<code>warningReturn {<perl code>}</code><br>
|
||||||
Like errorReturn, just for the warning list.
|
Like errorReturn, just for the warning list.
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>whitelist {<perl code>}</code><br>
|
||||||
|
Space-separated list of devspecs which are allowed.<br>
|
||||||
|
If the attribute is set all devices which are not specified by the
|
||||||
|
devspecs are removed from both lists.
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#readingFnAttributes">
|
<a href="#readingFnAttributes">
|
||||||
<u><code>readingFnAttributes</code></u>
|
<u><code>readingFnAttributes</code></u>
|
||||||
@ -1197,6 +1223,13 @@ attr BeamerFilter_monitoring warningFuncRemove {return}</pre>
|
|||||||
<code>warningReturn {<perl code>}</code><br>
|
<code>warningReturn {<perl code>}</code><br>
|
||||||
Wie errorReturn, nur für die warning-Liste.
|
Wie errorReturn, nur für die warning-Liste.
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>whitelist {<perl code>}</code><br>
|
||||||
|
Durch Leerzeichen getrennte Liste von devspecs die erlaubt sind
|
||||||
|
werden.<br>
|
||||||
|
Wenn das Attribut gesetzt wird werden alle Geräte die nicht durch die
|
||||||
|
devspecs definiert sind von beiden Listen gelöscht.
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#readingFnAttributes">
|
<a href="#readingFnAttributes">
|
||||||
<u><code>readingFnAttributes</code></u>
|
<u><code>readingFnAttributes</code></u>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user