Conditional Timing Logic best practice

#1

I'm creating a trigger based on event X. However, I only want to activate the trigger if event Y has not happened in the last, say 5 minutes.

In other words, every time event Y happens, kill my trigger for 5 minutes.

What would be the Node Red best practice to accomplish that?

Thanks, Richard

0 Likes

#2

Hi @RichardU

The Trigger node, or a combination of them, can probably do what you want.

This recipe from the cookbook probably comes close: https://cookbook.nodered.org/basic/trigger-placeholder

0 Likes

#3

Thanks. I ended up using trigger nodes to send boolean true, followed by boolean false in five minutes. Those flow into a change node which sets a flow variable. I then test that variable using a switch node (which is like an IF statement).
Cheers, Richard

1 Like

#4

You might be able to replace the change and switch nodes with a gate node (node-red-contrib-simple-gate). Just close the gate for five minutes each time the the trigger nodes receive event Y.

0 Likes