#How to trigger automations using the button on dashboard

1 messages · Page 1 of 1 (latest)

neat jetty
#

I want to run an automation that turns off my lights and laptop. But I want the automation to be triggered by a button on the dashboard.

rare sonnet
#

use a script and call the script

#

you don't need an automation for that

neat jetty
#

What's the difference between a script and automation??

#

And if I want to automate the script I can ask ha to run a automation that runs the script?

#

Honestly I don't get why ha doesn't allow you to use a button card to run an automation, but only give options to toggle the automation

#

Thanks for the help

toxic obsidian
#

a script and an automation are very similar. with a few minor differences. e.g. automations have triggers

i think you can call an automation from a tap action button with the "Automation: Trigger" action
but writing it in a script is how i would do it. then call the script and if i want it automated then call the script from an automation

rare sonnet
#

Honestly I don't get why ha doesn't allow you to use a button card to run an automation, but only give options to toggle the automation
Because, as mentioned, it's weird to "run" an automation

#

you're just barking up the wrong tree - use a script

#

a script is essentially just the "action" part of an automation, which is all that you want to do

queen forum
# neat jetty And if I want to automate the script I can ask ha to run a automation that runs ...

You can totally do this: just specify the script you wish to run as an action in actions: of an automation.

Also, if you want to just run the actions: of an automation regardless of the triggers (i.e. treat it as if it were a script), you can use automation.trigger. The caveat is that if your automation actions depend on some data coming from the triggers:, it will error out as automation.trigger bypasses the triggers: entirely. To prevent this, using a script is better as it allows you to declare the required data in variables at the point of running.