Is it possible to define many triggers fro automation script

Hello everyone

I wonder if I can define multiple triggers for an automation script
for example, I want

  • on manual (UI button)
  • every 2 hours

is that possible instead of creating two different scripts?

It is possible yes; return an array of triggers instead of a single one.

Just make sure you set the run as to make the interval script work.

In case your manual trigger needs to know who ran it (the invoker), I would suggest having two separate scripts where both call the same function (can be placed in some lib/util file),

1 Like