Trigger state node if the condition is met for a certain time

Hi there,
I am using a trigger state node to trigger some automations. But I want to trigger the automation only when the condition is met for a certain amount of minutes. I know that the state changed node allows this easily, but I decided to use the trigger state node because it can be activated/deactivated with an input.

Is there a way to combine both features (only trigger after a few minutes and deactivate the node)? Or does anyone have an idea for a simple flow that could achieve this?

Thanks for your suggestions!

If you look in the help panel for the event state node.

image

Enabling that option and installing this integration will give you a switch entity for the event state. Before enabling make sure there is a name in the name section of the node settings, this will be the name of the switch entity.

Trigger State Node provides the ability to control its activity time. To enable that, check the “Enable Input” checkbox in the node settings. Then send “enable” or “disable” to this input whenever you need.

The other way, especially if you need to check the condition at the time the Trigger State node picks up the event, is to let the trigger note output the event, and then use subsequent nodes to block it or pass through. In my opinion, it’s better than creating a loop-back with an HA switch (which needs to ne conditionally toggled anyway)

That works perfectly!
Anyway, I like to do most of the automation in Node Red itself and not call so many HA services to set any “helper switches”. This is for no good reason but my own aesthetic preferences :smiley:

What I came up with now is that I forward the event from the trigger state node to a trigger node. This trigger node is set to forward the message after a certain period of time. Then I connected the “blocked” output of the trigger state node to send a “reset” message to the trigger node to cancel the trigger node timer.

In this example I want to trigger an automation when the brightness exceeds a value of 40000lux. When this happens I start the trigger node. If the brightness then falls below 40000lux within the time set, the trigger node is reset via the “blocked” output.

2025-05-13 08_42_04-Clipboard