# Stop rule running again for x minutes

**URL:** https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198
**Category:** General
**Created:** [31 August 2022 20:14 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198 "2022-08-31T20:14:46Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![djseek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/djseek/32/67001_2.png) [@djseek](https://discourse.nodered.org/u/djseek)
#### Post date: [31 August 2022 20:14 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/1 "2022-08-31T20:14:46Z")

</div>

Hello,

I have a simple rule that is triggered on motion detection.

If the rule has been triggered in the last 60 minutes i'd like for it to not run again.

I thought of setting it up to use no motion for 60 minutes trigger but that would be invalid as it's the same motion sensor that would trigger the rule.

what would be the easiest way to do this? a boolean (not sure how to do that). any sample someone could provide would be greatly appreciated.

Thank you

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [31 August 2022 20:26 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/2 "2022-08-31T20:26:36Z")

</div>

The trigger node should be able to do what you want

---

<div class="post-metadata">

### Author: ![djseek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/djseek/32/67001_2.png) [@djseek](https://discourse.nodered.org/u/djseek)
#### Post date: [31 August 2022 21:26 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/3 "2022-08-31T21:26:18Z")

</div>

thank you - how would I do that sorry? add additional conditions?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [31 August 2022 21:40 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/4 "2022-08-31T21:40:25Z")

</div>

Did you try it. Maybe set to send original message on first input. Then wait 60 mins, extend if retriggeref, then send nothing.

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [31 August 2022 21:40 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/5 "2022-08-31T21:40:57Z")

</div>

Show us your flow that you have now and we can add the trigger in there

Can you clarify though - if the Motion is detected within the 60 minutes window - does the window reset and wait for another 60 minutes or does it proceed regardless ?

Craig

---

<div class="post-metadata">

### Author: ![djseek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/djseek/32/67001_2.png) [@djseek](https://discourse.nodered.org/u/djseek)
#### Post date: [31 August 2022 21:44 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/6 "2022-08-31T21:44:40Z")

</div>

here's how I have it now:

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

If no motion for 60 minutes on office motion then if there is motion it should trigger.

Ideally yes if motion is detected in that 60 minute window it should restart the timer.

thank you for your replies

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [31 August 2022 22:48 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/7 "2022-08-31T22:48:10Z")

</div>

There is a very similar thread to this running on the Node red forum in Home Assistant - might be worthwhile you grabbing the flow from there as it appears to have resolved

> **[Light not turning on after motion is detected a second time](https://community.home-assistant.io/t/light-not-turning-on-after-motion-is-detected-a-second-time/453780/25)**
>
> After an evening of real world use i think you are right. It was not really noticeable apart from in the kitchen where even though we were in it the light was still going off way quicker than it should. So i have changed the flow for the kitchen to...

Craig

---

<div class="post-metadata">

### Author: ![djseek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/djseek/32/67001_2.png) [@djseek](https://discourse.nodered.org/u/djseek)
#### Post date: [31 August 2022 23:19 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/8 "2022-08-31T23:19:09Z")

</div>

i used the wrong trigger node i thought you meant trigger state.

this seems to be working

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f003f779cc75848c5c99740de5369efe67363b8.png)  
(10 min as example)

although i think it will send 1 then wait 10mins and send another msg even if there is no additional motion

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [1 September 2022 05:39 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/9 "2022-09-01T05:39:27Z")

</div>

You may also want to select the extend option for when it gets retriggered part way through

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [15 September 2022 05:39 UTC](https://discourse.nodered.org/t/stop-rule-running-again-for-x-minutes/67198/10 "2022-09-15T05:39:50Z")

</div>

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