How to filter out every second MQTT-trigger-event?

Hi, I'm new here :slight_smile:
(sorry, english is not my native language)

I got a "special" question about the possibility of filtering out every second trigger-event from an MQTT-input-node.

Why?/Background: I recreated this fantastic setup from Andreas Spieß: https://www.youtube.com/watch?v=L0fSEbGEY-Q . With the help of the SDR-stick and "rtl_433" I receive the values of the outdoor weather station (WH1080) of my neighbor on my RaspberryPi. These datagramms where convertet to MQTT-Messages which I handle with node-red to display the values in the dashboard. This works fine and looks great. Additional I installed MySQL to the RasPi to archive these values for later fun. This works also fine.

Problem: On every time the wheather-station sends (about every 50 seconds), it sends its values twice directly one after the other! So node-red receives two MQTT-Messages and my flow starts also twice (in nearly the same time) This is no problem for watching the values live on the dashboard. But now i have the double values in the MySQL-Database. Sometimes it differs one second, sometimes I got an MySQL-Error because the timestamp is the same.

The goal is, to have only one (set of) value(s) every 50s. Is there an elegenat way to "filter out" every second event?

Thanks for your ideas!

Have a look at the built in delay node, it will do what you want. Personally I would have a look as to why the weather station is sending the messages twice.

2 Likes

If the messages are identical look at the RBE node (report by exception) it will only send on the message if it is different

2 Likes

Thank you very much! At first I thought those two messages were always the same and the RBE node would do it. But unfortunately, they are not always :(. But with the delay it seems to work. :+1:

@ghayne: I don't know why it is sending twice. It's a proprietary piece of hardware. I think it should be a mechanism against transmission errors or something.

As ghayne proposed you, use the delay node and set as limit to 1 message every 50 sec for instance, select the drop intermediate messages option.

Regarfds

2 Likes