Checking for stable message before forwarding



I have a node red sensor input that I want to check is stable for 1min before forwarding on. I can’t find a simple way to do this.

My use-case is that I have a location beacon that shows I’m either home or not home - However there is a very small period of flux where the location beacon will sometimes loose connection and reconnect causing a transition the occasional home to not_home back to home I would like it to ignore the the ‘blips’ within a window of 1min.
Any help will be appreciated.




It sounds like you could use the trigger node to do this (one of the built-in core nodes), According to the info sidebar:

This node can be used to create a timeout within a flow. By default, when it receives a message, it sends on a message with a payload of 1. It then waits 250ms before sending a second message with a payload of 0. This could be used, for example, to blink an LED attached to a Raspberry PI GPIO pin.

The payloads of each message sent can be configured to a variety of values, including the option to not send anything. For example, setting the initial message to nothing and selecting the option to extend the timer with each received message, the node will act as a watchdog timer; only sending a message if nothing is received within the set interval.

It sounds like you would set it to send nothing, have it wait 1 min and forward the original msg, but extend the time if a new msg arrives. This way, you will only see the latest state msg after a minute has gone by without changes.



This worked great, thanks!