#Automation vs Scripts

1 messages · Page 1 of 1 (latest)

cold heart
#

I don’t know but for some reason I’m struggling to figure out how to use scripts. It seems like you can do everything you would ever need in an Automation so why bother? Can someone help me understand or share some examples that make the most of Scripts?

rotund sundial
#

an automation is just a script with a trigger and condition

#

if you don't need a trigger or condition, then you can use a script

#

you can just call a script when you want, and return a result if you want

humble nest
#

Repeatable actions too. Why create a good night and a good bye automation if you're going to do the same thing with both. Call the script

cold heart
#

So it really comes down to whether or not I need a trigger?

rotund sundial
#

Mainly, yes

#

The timing semantics are also different. By default, scripts run to completion when called, but triggering an automation runs in parallel. But that's configurable

golden haven
#

Usually you use a script if you want to reuse the same code multiple times in different automations like @humble nest explained.
For example I have a script to notify my wife's and my phone. I use that in multiple automations, it also supports announcing the message on our echo dots.
If I ever want to change something with that logic I have a single place to modify, not dozens of automations