How to filter out "flapping" status

Can someone advise me on the following please?
I have an Bluetooth beacon and use geofency on my phone to call an http endpoint in nodered when the phone comes near to the beacon, and as well wenn it leaves the vicinity of the beacon (check-in / check-out).
Now while the phone is near the beacon, it occasionally loses the bluetooth connection for a second or so. So the signal is flapping in a short time frame which leads to frequent check-ins and outs.
Any idea how to filter this? Something like:
Getting an "out" after an "in" is delayed for 10s and only forwarded of no inverted signal is recieved within that timeframe or similar.
open for ideas.

thanks a lot!

Try using the filter/rbe node. It should be able to filter messages until a property value changes.

Thanks, I don't think that alone will solve it because the fluttering signal does represent changes.
However, I just found a node which seems to be designed for doing exactly what I want: node-red-contrib-debounce-leading-trailing. Will give it a try.

If you provide more info on incoming msg's, we could give example of how to use filter node

It basically is either msg.payload.dir === "in" or msg.payload.dir === "out"

But while being "in", it may happen that an "out" appears, followed by another "in" within 10s.
In that case, no change would happen.
If however no "in" follows the "out" within 10s, then the change happens.

thank you!

So use a trigger node in combination.


the trigger node will pass the latest msg received within 10 seconds

1 Like

Have a look at the delay node too.

that's pretty clever. Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.