Loop timer locking up HASS

I’m trying to wrap my head around how the loop timer works. I must be using it wrong because my flow below will lock up my entire HASS. I have two sensors in this room. Motion and a door contact. If the door is open I’m trying to have the flow check and keep the light on until it is closed or the (loop) timer times out (5mins). If the door is closed the flow works fine but if the door is left open HASS locks up.


Watching the debug when the door is left open, it floods open messages repeatedly. Like every second instead of every 30 seconds as I would have expected. I assume this is running HASS out of memory or something but I can’t actually check cause it’s frozen in the GUI. Any guidance would be appreciated!

Why don’t you use a delay instead of timer?

My goal is to have the light turn off quickly if the door is closed (and no more motion) but I still want the light to turn off after a longer delay if someone leaves the door open. So I need some mechanism that would eventually ‘give up’.

If I used a ‘delay’ I would be stuck with the longer timeout with no opportunity to have the light turn off sooner if someone closed the door, If I’m understanding it’s usage here… but this appears to be a reasonable solution so thanks for that tip.

Also I am in learning mode and apparently I am not grasping the functionality of how this loop timer works.

Then use a “stoptimer node” it will be reset everytime on new input.

Looptimer has a very rare and unusual application (as far as I know).

1 Like

This seems pretty perfect for the “wait until” node:

I’m going to assume for purpose of example that your door open sensor is called binary_sensor.door and has state off when it is closed and on when it is open, feel free to adjust accordingly. In your flow there you can point that trigger node straight into a wait until node. Set that wait until node to wait until binary_sensor.door has a state of off with a timeout of 30 seconds. The wait until node has two outputs, one for when the condition you are waiting for has been met (i.e. the door has been closed) and the other for when the timeout has been met (i.e. person walked away and left the door open) . Connect both of those outputs to turn lights off.

What will happen then is exactly what you want, if the door has been left open for 30 seconds with no motion or closed then the light will be turned off. Every time new motion is detected the timer will restart as it says in the notes for the wait until node. And the second the door is closed the wait until node will kick out, stop its timer and turn the lights off.

Also if your motion sensor is streaming too many messages you can insert a delay node right after your trigger:state mode with action “rate limit” to cut down on the noise and limit the number of messages that can enter the flow in a given time range:

@sender thanks for the guidance, I came up with this:

@CentralCommand I overlooked that under the HA section (was focused on functions) but that also looks like something I could have used. Thanks for the tip!

Goodluck! And remember, in node red there are multiple ways to achieve your desire. And even if you are very experienced even simple logical wishes can be very hard to translate into flows…