Is it possible to make a script execute a bunch of services simultaneously?

Tags: #<Tag:0x00007f325ed6c300>

A little while ago I was advised to use scripts instead of scenes to set up my lights.

This works fine as long as all my lights respond immediately, but some times I have a troublesome light that is responding extremely slowly or has stopped responding altogether.

In this case, the script seems to stop at that light and wait for it to respond (or time out) before continuing. This halts the entire script for a few seconds, causing my light setup to awkwardly sit between 2 scenes for a few seconds.

Rather than running a sequence of services and waiting for each of them to succeed, is it possible to make a script execute a bunch of services without waiting for each of them to finish? Can HA even run multiple services simultaneously? :thinking:

Yes, you have to use ‘script.turn_on’ if you don’t want to wait for the script to finish.

Put your trouble light in a script, then call “script.turn_on” for that script.

sequence:
  - script.turn_on
    entity_id: script.trouble_light
  - light.turn_on
    entity_id:
      - light.good_light_1
      - light.good_light_2

Only problem is you can’t pass data into it. So you might need 2 scripts, one for on, one for off.