How to ignore specific readings?

Begonnen von id001, 23 März 2021, 16:54:19

Vorheriges Thema - Nächstes Thema

id001

Hello all! I have a problem and need some help.

I have a modbus to mqtt gateway which sometimes cant read the values correctly from my energy meters and returns "bad" instead of the values. See the attached picture.
The problem is with the statistics module. If at the end of the hour when the statistics are calculated for the last hour the "bad" reading messes up the values and the graphs, too.
How can I ignore this reading?

Thank you.

Beta-User

You're a little spars wrt. to details how readings are generated (no list or RAW definition provided).

If it's always the word "bad", you could try to filter these words out by using some Perl in your readingList attribute.
Based on this from the 6channel_ethernet_board_6input_split attrTemplate:
attr DEVICE readingList Advantech/DEVNAME/data:.* { $EVENT =~ s/true/"on"/g;; $EVENT =~ s/false/"off"/g;; my $rets = json2nameValue($EVENT,'',$JSONMAP);; my %cleaned = map { $_,$rets->{$_} } grep { ReadingsVal($NAME,$_,"unknown") ne $rets->{$_} } keys %{$rets};; return \%cleaned }\
I'd suggest sth. like
attr DEVICE readingList <your topic>:.* { my $rets = json2nameValue($EVENT,'',$JSONMAP);; my %cleaned = map { $_,$rets->{$_} } grep { 'bad' ne $rets->{$_} } keys %{$rets};; return \%cleaned }
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files

id001

Thank you, this is what I wanted.