Help with trigger/condition

I am trying to convert one of my automation to node red but am having some trouble.

I want to send a notification if the state of a sensor changes from false to true and stays that way for 3 minutes.

I’m not sure how incorporate the 3 minute wait into node red. I think I have the rest figured out. The trigger in the home assistant automation is as follows

Trigger type: State
from: false
to: true
for: 00:03:00

Could I just use a simple delay node? Would this delay be reset when the state changes from false to true and back to false?

1 Like

You can use the delay node.

To stop the flow, use the “Halt if state” is false.

1 Like

I was trying to accomplish the same thing. This looks like a simple solution, I’ll have to give it a try.

Works great! Very simple solution.

No, it won’t, areks solution only check if the state is true 3 minutes after every state change to true, without noticing how many times it changed in between. A better solution for your problem would be to use the trigger node, configured like this it will only emit states stable for at least 3 minutes and discard every state which is not. Then a simple switch node to check if the state (which have been stable for 3 minutes) is actually true.

Note that you have to check the “Output only on state change” checkbox on the events:state node.



Oh, I totally missed that part when I read the message. Your solution is indeed the correct one for this problem!

Thank you both for your responses. I have updated the flow and it works as intended.

1 Like