Is it possible to call an automation from a script? The idea would be to expose the script instead of the automation and I would preserve the work done with automations…
If you don’t want to use a script, best practice would probably be to have Alexa turn on a toggle helper (input_boolean), then include an extra trigger in your automation for that.
Don’t forget to turn the helper off again at some point, or the trigger won’t fire a second time.
Just to end the thread, it is perfectly possible to call an automation from a script. It is ALSO recognized as a scene in alexa, but calling it, works.
alias: "name that will be exported to alexa and called for execution by a voice command"
sequence:
- service: automation.trigger
target:
entity_id: automation.name
data:
skip_condition: false
mode: parallel
icon: mdi:script
max: 2
Yes, but the original poster should understand the difference between a script and an automation before you just say “call a script from an automation”.
An automation is triggered to happen when something changes (like a state, or a time, or whatever).
A script is things to do.
Once you fully grasp that, you can then delve in. Most every “automation” I have call scripts. Because I want those to happen when something changes. But if I want them on demand, I may have Alexa call the script directly. And I say “may” because maybe the script triggers if an input_boolean goes from off to on, so I can just have Alexa change the boolean (and then Home Assistant runs the script).
There is no perfect answer. But as a long time user, I would always create scripts and then automations that trigger those scripts. I would never put anything I may want to reuse verbose in an automation. Separate the logic from the actions.