Use input (fields) in script as sequences


How can I use a field (input to a script), such as

      name: Actions
      description: Actions
      default: []

- service: script.turn_om
    entity_id: script.test_script
         - service: [...]

in an sequence in the script?

E.g you can do this with automation blueprints, e.g

- choose:
  default: <-- run it here

But I’m not able to do it in a script. Any ideas how I can accomplish that?

Not quite like that. You could put the service itself (the part you indicated with the ellipsis) in a variable and use it as a template, e.g.:

- service: "{{ the_service }}"

where the_service is e.g. light.turn_on.

Put more technically: If you’re used to the typical eval function many languages have, you can’t do that here.

Congrats on the worst comment of the year! :tada:

Ah, its too bad. I like how you can call any sequence from inputs in blueprints.

<-- automations.yaml -->
  path: bp.yaml
      - wait_for_trigger: 
      - service: system_log.write
      - [..]
<-- bp.yaml -->
- choose:
  default: !input actions

If anyone knows how this can be accomplished from one script (passing it as variables) that script.turn_on another script, I would appreciate to hear from you.


Everything you asked about is available at the link I posted. You just have to put a little effort in to read and understand it. I’m not spoon feeding you. Especially after that comment.

Good luck.

1 Like

It’s not. It shows how to pass variables (title and message) and use them in a notification of the called script, not to call them like described here - and that’s what my question is about.

You put your actions in a script and call that, passing any variables you need to.


  • If you want to alienate others, that’s how to do it. However, it’s self-defeating because it’s a disincentive for others to help you.

  • There are tens of thousands of users in this community forum. However, only a surprisingly small number of them regularly volunteer their time to help others … and you just made a needlessly snarky reply to someone who helps a lot of people.

  • FAQ Guideline 22


Hello, found this thread as I was trying to do a similar thing.

After searching around on GitHub and testing it out myself, it seems you can’t execute an action passed into a script as a field (a runtime variable). You can, however, execute an action set when the script is configured.

For example, see the “confirm” and “dismiss” actions in this blueprint: core/confirmable_notification.yaml at b6d001bfe6f00db0461861c0894d5bc83306b038 · home-assistant/core · GitHub

The downside to this, obviously, is once the script is configured to do A and B, it will only ever do A and B, rather than allowing the user to tell it to do C on this specific run.

(To make it run the sequence of action(s) you’ve set, you can use a conditional. You can bypass the conditional by setting it to “true”: HAConfig/medication_reminder.yaml at 4feba7a7650adb23dbd36622911cab7d9e5a798d · MTrab/HAConfig · GitHub)