# Stop state change from running within a time window

**URL:** <https://discourse.nodered.org/t/stop-state-change-from-running-within-a-time-window/14900>\
**Category:** General\
**Created:** [29 August 2019 12:10 UTC](https://discourse.nodered.org/t/stop-state-change-from-running-within-a-time-window/14900 "2019-08-29T12:10:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nixdat](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@nixdat](https://discourse.nodered.org/u/nixdat)\
**Post date:** [29 August 2019 12:10 UTC](https://discourse.nodered.org/t/stop-state-change-from-running-within-a-time-window/14900/1 "2019-08-29T12:10:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [29 August 2019 13:03 UTC](https://discourse.nodered.org/t/stop-state-change-from-running-within-a-time-window/14900/2 "2019-08-29T13:03:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nixdat](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@nixdat](https://discourse.nodered.org/u/nixdat)\
**Post date:** [30 August 2019 02:16 UTC](https://discourse.nodered.org/t/stop-state-change-from-running-within-a-time-window/14900/3 "2019-08-30T02:16:09Z")

</div>

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](https://cookbook.nodered.org/basic/rate-limit-messages)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3c58e104f1585e1ec63e54d6e81c983f5f39d551.png)

This will do what I need it to do

Thanks again
