HeadshotsExplorationAboutIndex

Running Scripts
Sync vs Async

When an automation calls a script in Home Assistant, it runs synchronously by default. That means the automation waits for the script to finish before completing itself. This has big implications for how long automations appear to be “running”, and how mode handling behaves.

What “Synchronous” Really Means

action:
  - service: script.do_something_long

This is the same as if you had copy-pasted all of script.do_something_long directly into your automation. It becomes part of the automation’s own execution path.

What actually happens under the hood

  1. The automation triggers
  2. It calls the script
  3. It waits for the script to finish (including delays, waits, etc.)
  4. Only then does the automation return to “idle”

This is why long-running scripts make your automation appear “running” for longer.

Benefits of running scripts synchronously

Want to Run a Script Asynchronously?

You can bypass the sync behavior using script.turn_on. This tells Home Assistant: “Run this script, but don’t wait for it to finish.”

action:
  - service: script.turn_on
    target:
      entity_id: script.do_something_long

What this changes

Rule of Thumb

Use this When you want
script.do_something Full control over execution order and mode handling
script.turn_on Fire-and-forget behavior; let the automation move on

If you’re working on modularizing your automations, this is a key piece of how execution flow works in Home Assistant.




Francis Fontaine