Stop state change from running within a time window

Hi There,

I'm new to node-red and looking for some pointers. I have looked through the forums but can't seem to find what I'm after.

Problem: I have a d1 mini present detector in my car, so when I leave or arrive home my garage door opens automatically. It works okay but I'm having issues with the signal dropping in and out. In the morning when I leave the house I shut the roller door and second later it will open again.

Question: Is it possible to set up an automation to drop the state change if it has already received it within a 5-minute window, if so how would I go about it?

Thank you for your help and guidance

Nick

You could try a delay node in rate-limit mode for a sliding time window and select 'drop intermediate messages'

Excellent thank you bakman2 for the suggestion, didn't think delay timers worked in this fashion. I was overthinking the solution but come across the following post on the node red site

Slow down messages passing through a flow

https://cookbook.nodered.org/basic/rate-limit-messages

image

This will do what I need it to do

Thanks again

1 Like