Question about sequential execution in nested scripts - different, than expected

Hi community,
please advise to my question.

For controlling the execution flow in HA, there are building blocks like “parallel” or “sequential”, although the default flow is sequential.

I’m struggling with the return of a nested script calling, and the resulting time line.

To break it down I created two test scripts: Test.Main and Test.Wait - see images. In both cases I use HA notifications to trace the time line.

Expected: Execution of Test.Main should terminate after the call of Test.Wait is done - so in my scenario after 2 minutes.

Real result: I get immediately the Start of Test.Main, the End of Test.Main and the Start of Test.Wait. After 2 minutes I get End of Test.Wait.

I understood the documentation, that the flow in Test.Main is “waiting” until Test.Wait is finally executed, but this seems to be wrong.

Even moving the notifications and the wait-command in Test.Wait into a sequential block does not change anything.

I can circumvent this by adding a Wait.For.Trigger after calling Test.Wait with the condition: Wait until Test.Wait gets inactive.

But this is additional text/code and blows up my scripts.

Any comments on my misunderstanding?

Is there a different way to achieve my wish?

Any feedback highly appreciated!


There are two ways to call a script. One waits for completion of the script the other does not - this is the one you are using. See: Scripts - Home Assistant

Use:

action: script.test_wait # scripts are also actions

Not:

action: script.turn_on
target:
  entity_id: script.test_wait

Perfect explanation - thanks!
For 99% I use the UI to configure my system. I will double check the documentation for this option - for now: any way to configure this in UI mode as well?
Checked and found myself… Many thanks!