From 38fc67d229920330ce60255d45cff26a41544975 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Wed, 21 Sep 2016 19:02:22 +0000 Subject: [PATCH] fhem.pl: suppressReading attribute (Forum #57841) git-svn-id: https://svn.fhem.de/fhem/trunk@12191 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/docs/commandref_frame.html | 116 ++++++++++++++------------- fhem/docs/commandref_frame_DE.html | 122 ++++++++++++++++------------- fhem/fhem.pl | 15 +++- 4 files changed, 141 insertions(+), 113 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index a939d2a72..c063ee05f 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. + - change: suppressReading attribute added for all devices (Forum #57841) - bugfix: 88_HMCCU: Fixed CUxD device datapoint handling - change: 10_IT: create events during readings update. change logging diff --git a/fhem/docs/commandref_frame.html b/fhem/docs/commandref_frame.html index 596429aef..e3cd948d5 100644 --- a/fhem/docs/commandref_frame.html +++ b/fhem/docs/commandref_frame.html @@ -339,65 +339,17 @@ Device specific attributes are documented in the corresponding device section. diff --git a/fhem/docs/commandref_frame_DE.html b/fhem/docs/commandref_frame_DE.html index 008916cc9..0a25bc37a 100644 --- a/fhem/docs/commandref_frame_DE.html +++ b/fhem/docs/commandref_frame_DE.html @@ -338,66 +338,17 @@ Gerät dokumentiert.

Globale Attribute für alle Geräte

diff --git a/fhem/fhem.pl b/fhem/fhem.pl index f20b7432d..bb3bb83c5 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -233,8 +233,10 @@ use vars qw(@structChangeHist); # Contains the last 10 structural changes $selectTimestamp = gettimeofday(); $cvsid = '$Id$'; -my $AttrList = "verbose:0,1,2,3,4,5 room group comment:textField-long alias ". - "eventMap userReadings:textField-long"; +my $AttrList = "alias comment:textField-long eventMap group room ". + "suppressReading userReadings:textField-long ". + "verbose:0,1,2,3,4,5"; + my $currcfgfile=""; # current config/include file my $currlogfile; # logfile, without wildcards my $duplidx=0; # helper for the above pool @@ -2568,6 +2570,12 @@ CommandAttr($$) } } + if($attrName eq "suppressReading") { + return "Argument must be a valid regexp" if(!$a[2] || $a[2] =~ /^\*/); + eval { "Hallo" =~ m/^$a[2]$/ }; + return "Bad regexp: $@" if($@); + } + $a[0] = $sdev; my $oVal = ($attr{$sdev} ? $attr{$sdev}{$attrName} : ""); $ret = CallFn($sdev, "AttrFn", "set", @a); @@ -4052,6 +4060,9 @@ readingsBulkUpdate($$$@) "readingsBeginUpdate first."; return; } + + my $sp = AttrVal($name, "suppressReading", undef); + return if($sp && $reading =~ m/^$sp$/); # shorthand my $readings = $hash->{READINGS}{$reading};