How to add wait time between triggers

Hi All,

I’d like to know if it is possible and how to add a waiting time between the execution of different triggers in the same button widget.
I have several triggers executed in a sequence on the same button and would like to add a “wait” between the execution of each trigger.

Thanks fror any suggestions

1 Like

Hi @marco.negonda, this is a great question, thanks for asking! There’s no way to add this wait functionality within a single trigger. There are work arounds, though. One thing you could do is use a boolean variable to check if a trigger has been executed. You could then use a timer-trigger to check the status of the boolean, and if it’s the correct state, fire the rest of your logic.

So the order would be Execute First trigger >> Set Boolean to True >> One a timer trigger, check If Boolean is TRUE, after X duration fire the Trigger >> Convert boolean back to false.

You could also play around with this stopwatch customer widget

There are a bunch of ways to approach this so please share what you come up with!

2 Likes

Hi John,

thank you for your quick reply and proposal. As far as I know timer triggers are only available at step level and not at buttons level, is it correct?
In my case what I’d like to achieve at button level is the following:

  1. execute trigger 1
  2. wait n seconds to allow backend system to record the action of trigger 1
  3. execute trigger 2
  4. execute trigger 3

Is there any way to make it work without changing the app logic (app is already in use in Production system)?

Regards,
Marco

You can do it using a machine or device trigger.

When you are ready for the pause or delay, send a command to something outside of tulip (could be Node-RED, PLC, microcontroller, etc.) that responds to a machine api or device trigger after so many seconds have passed that triggers your next set of triggers.

Another option could be in a custom widget that outputs after so many seconds.

Hi @marco.negonda,

I had exactly the same problem before.
I build this custom widget to solve it:
customWidget-MS Timer.json (1.8 KB)

Use it like this :

  1. execute trigger 1 + put a boolean at true
  2. Put trigger 2 and 3 in the event “timeOut” of the custom widget.

The boolean variable will be automatically reset at 0.

If you need more help, ask me.

Regards,
Rémi Bayon