Does an action in a script delay the start of the next action

Tags: #<Tag:0x00007f32861eacc0> #<Tag:0x00007f32861eab80> #<Tag:0x00007f32861eaab8>

Hi all. Now that the GUI has a much better support for managing automations and scripts, I’m moving my automations back out of NodeRed and into yaml through the front end editor. I’ve split things to use automations for the triggers (device state changes, it’s 9pm, etc) and then I’m running scripts to perform the actions so I can include multiple actions with their own conditions. For the most part, these seem to be ok but I’ve a few strange events happening that I think might be due to either the order of events or the way scripts deal with actions that take some time to perform in a different way to NodeRed.

Eventually, the question…

If I have a script with 2 steps in the sequence, but one of those takes some time to complete, for example turn down a light with a 5 minute transition, does that delay the second action in the sequence for the 5 minutes the previous step takes to complete? In NodeRed I would link both of the next actions to the same trigger event so they would both start at the same time.

I can’t quite get my head around what’s happening and don’t have time right now to create a set of test scripts to play with and evaluate all the options so any pointers would be greatly received.

No. The light service is executed and then the next step in the sequence is immediately executed.

If you are calling a script after a script it depends on how you are calling that script.

This will wait for previous script to finish

- service: script.name

This will not wait for previous script to finish

- service: script.turn_on
  data:
    entity_id: script.name

Otherwise, services are called immediately after one another as @tom_l says.

Thanks for the quick reply Tom. That at least takes one thing off the list of things to check.

Thanks Andy. I’m using the script.turn_on function so there shouldn’t be a delay. I’m beginning to suspect I’ve just overcomplicated things with too many changes at the same time (automations, calling scripts, activating scenes) and I need to rethink and simplify things a little.