diff --git a/fhem/CHANGED b/fhem/CHANGED
index d4add549f..30d010a2e 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: notify/FileLog: add ignoreRegexp attribute (Forum #79684)
- feature: 46_SmartPi: add decimal Attr, fix Notify bug
- bugfix: 74_XiaomiFlowerSens: fix many Notify bugs
- change: backup is always started in the background (Forum #80237)
diff --git a/fhem/FHEM/91_notify.pm b/fhem/FHEM/91_notify.pm
index a64e14ad6..6fb92e9c4 100644
--- a/fhem/FHEM/91_notify.pm
+++ b/fhem/FHEM/91_notify.pm
@@ -16,7 +16,7 @@ notify_Initialize($)
$hash->{NotifyFn} = "notify_Exec";
$hash->{AttrFn} = "notify_Attr";
$hash->{AttrList} ="disable:1,0 disabledForIntervals forwardReturnValue:1,0 ".
- "readLog:1,0 showtime:1,0 addStateEvent:1,0";
+ "readLog:1,0 showtime:1,0 addStateEvent:1,0 ignoreRegexp";
$hash->{SetFn} = "notify_Set";
$hash->{StateFn} = "notify_State";
$hash->{FW_detailFn} = "notify_fhemwebFn";
@@ -72,6 +72,7 @@ notify_Exec($$)
my $n = $dev->{NAME};
my $re = $ntfy->{REGEXP};
+ my $iRe = AttrVal($ln, "ignoreRegexp", undef);
my $events = deviceEvents($dev, AttrVal($ln, "addStateEvent", 0));
return if(!$events); # Some previous notify deleted the array.
my $max = int(@{$events});
@@ -89,6 +90,7 @@ notify_Exec($$)
$found = ("$n:$s" =~ m/^$re$/);
}
if($found) {
+ next if($iRe && ($n =~ m/^$iRe$/ || "$n:$s" =~ m/^$iRe$/));
Log3 $ln, 5, "Triggering $ln";
my %specials= (
"%NAME" => $n,
@@ -133,6 +135,12 @@ notify_Attr(@)
return;
}
+ if($a[0] eq "set" && $a[2] eq "ignoreRegexp") {
+ return "Missing argument for ignoreRegexp" if(!defined($a[3]));
+ eval { "HALLO" =~ m/$a[3]/ };
+ return $@;
+ }
+
if($a[0] eq "set" && $a[2] eq "disable") {
$do = (!defined($a[3]) || $a[3]) ? 1 : 2;
}
@@ -518,6 +526,13 @@ END
FHEMWEB to display this value, when clicking "on" or "off", which is
often not intended.
+
+
ignoreRegexp regexp
+ It is hard to create a regexp which is _not_ matching something, this
+ attribute helps in this case, as the event is ignored if matches the
+ argument. The syntax is the same as for the original regexp.
+
+
readLog
Execute the notify for messages appearing in the FHEM Log. The device
@@ -735,6 +750,14 @@ END
Meldungen im Log zu haben.
+
+ ignoreRegexp regexp
+ Es ist nicht immer einfach ein Regexp zu bauen, was etwas _nicht_
+ matcht. Dieses Attribu hilft in diesen Fällen: das Event wird
+ ignoriert, falls den angegebenen Regexp. Syntax ist gleich wie in der
+ Definition.
+
+
readLog
Das notify wird für Meldungen, die im FHEM-Log erscheinen,
diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm
index 2215f277c..9ec4f0758 100644
--- a/fhem/FHEM/92_FileLog.pm
+++ b/fhem/FHEM/92_FileLog.pm
@@ -49,6 +49,7 @@ FileLog_Initialize($)
disable:0,1
disabledForIntervals
eventOnThreshold
+ ignoreRegexp
logtype
mseclog:1,0
nrarchive
@@ -181,6 +182,7 @@ FileLog_Log($$)
my $n = $dev->{NAME};
my $re = $log->{REGEXP};
+ my $iRe = AttrVal($ln, "ignoreRegexp", undef);
my $max = int(@{$events});
my $tn = $dev->{NTFY_TRIGGERTIME};
if($log->{mseclog}) {
@@ -197,6 +199,7 @@ FileLog_Log($$)
$s = "" if(!defined($s));
my $t = (($ct && $ct->[$i]) ? $ct->[$i] : $tn);
if($n =~ m/^$re$/ || "$n:$s" =~ m/^$re$/ || "$t:$n:$s" =~ m/^$re$/) {
+ next if($iRe && ($n =~ m/^$iRe$/ || "$n:$s" =~ m/^$iRe$/));
$t =~ s/ /_/; # Makes it easier to parse with gnuplot
if(!$switched) {
@@ -238,6 +241,12 @@ FileLog_Attr(@)
return;
}
+ if($a[0] eq "set" && $a[2] eq "ignoreRegexp") {
+ return "Missing argument for ignoreRegexp" if(!defined($a[3]));
+ eval { "HALLO" =~ m/$a[3]/ };
+ return $@;
+ }
+
if($a[0] eq "set" && $a[2] eq "disable") {
$do = (!defined($a[3]) || $a[3]) ? 1 : 2;
}
@@ -1305,6 +1314,8 @@ FileLog_regexpFn($$)
feature was implemented. A FHEM crash or kill will falsify the counter.
+ ignoreRegexp
+
logtype
Used by the pgm2 webfrontend to offer gnuplot/SVG images made from the
@@ -1626,6 +1637,8 @@ FileLog_regexpFn($$)
verfälscht die Zählung.
+ ignoreRegexp
+
logtype
Wird vom SVG Modul benötigt, um daten grafisch aufzubereiten.