mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
98_monitoring: add NOTIFYDEV
git-svn-id: https://svn.fhem.de/fhem/trunk@16841 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c093ff4f71
commit
5b55c0781d
@ -82,6 +82,7 @@ sub monitoring_Define($$) {
|
||||
return("Usage: define <name> $TYPE <add-event> [<remove-event>]")
|
||||
if(int(@re) < 1 || int(@re) > 2);
|
||||
|
||||
monitoring_NOTIFYDEV($hash);
|
||||
monitoring_setActive($hash) if($init_done);
|
||||
|
||||
return;
|
||||
@ -230,15 +231,19 @@ sub monitoring_Attr(@) {
|
||||
monitoring_modify("$SELF|error|remove|$name");
|
||||
}
|
||||
}
|
||||
elsif($attribute eq "whitelist" && $value){
|
||||
my @whitelist;
|
||||
elsif($attribute eq "whitelist"){
|
||||
monitoring_NOTIFYDEV($hash);
|
||||
|
||||
push(@whitelist, devspec2array($_)) foreach (split(/[\s]+/, $value));
|
||||
if($value){
|
||||
my @whitelist;
|
||||
|
||||
foreach my $list ("warning", "error"){
|
||||
foreach my $name (split(",", ReadingsVal($SELF, $list, ""))){
|
||||
monitoring_modify("$SELF|$list|remove|$name")
|
||||
unless(grep(/$name/, @whitelist));
|
||||
push(@whitelist, devspec2array($_)) foreach (split(/[\s]+/, $value));
|
||||
|
||||
foreach my $list ("warning", "error"){
|
||||
foreach my $name (split(",", ReadingsVal($SELF, $list, ""))){
|
||||
monitoring_modify("$SELF|$list|remove|$name")
|
||||
unless(grep(/$name/, @whitelist));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -459,6 +464,18 @@ sub monitoring_modify($) {
|
||||
return;
|
||||
}
|
||||
|
||||
sub monitoring_NOTIFYDEV($) {
|
||||
my ($hash) = @_;
|
||||
my $SELF = $hash->{NAME};
|
||||
my $NOTIFYDEV =
|
||||
AttrVal($SELF, "whitelist", undef) ||
|
||||
join(",", (InternalVal($SELF, "DEF", undef) =~ m/(?:^|\s)([^:\s]+):/g))
|
||||
;
|
||||
$NOTIFYDEV =~ s/\s/,/g;
|
||||
|
||||
$hash->{NOTIFYDEV} = $NOTIFYDEV;
|
||||
}
|
||||
|
||||
sub monitoring_RemoveInternalTimer($) {
|
||||
my ($hash) = @_;
|
||||
my $SELF = $hash->{NAME};
|
||||
|
Loading…
Reference in New Issue
Block a user