Ok, I’ve been reading the “Script Syntax” documentation, but I am not sure if I understand how stop:
and condition:
are different (at least in the case of the condition not being met) or how either of them behaves within parallel:
blocks or within other types of “sequences” like repeat:
, if:
, choose:
, etc.
The documentation seems to indicate that both will only ever finish the current sequence, never the entire script/automation unless called from the “base sequence”. However, some testing suggests that not only is that not correct, but that in fact condition: "{{false}}"
and stop:
behave differently.
The following test script will never log a “It finished” message. If I remove the 3 second delayed stop:
form the parallel block, it however will.
alias: Test Scipt
sequence:
- if:
- condition: template
value_template: "{{true}}"
then:
- service: notify.persistent_notification
data:
title: It's true!
message: It's true!
- alias: If enabled will prevent execution of remainder of script
enabled: false
stop: 'Stop in if block'
- condition: template
value_template: "{{false}}"
- alias: Will never run, but rest of script will continue
service: notify.persistent_notification
data:
message: Past condition/stop
title: Past condition/stop
- service: notify.persistent_notification
data:
message: Before paralell
title: Before paralell
- parallel:
- sequence:
- delay: 1
- alias: Will run and terminate this sequence
condition: "{{false}}"
- sequence:
- delay: 2
- alias: Will run and emit the notifcation
service: notify.persistent_notification
data:
message: After 2 seconds
title: After 2 seconds
- sequence:
- delay: 3
- alias: Will run and terminate this sequence and the remainder of the script
stop: After 3 second stop
- alias: Will never run because the stop in the parallel block terminated the script
service: notify.persistent_notification
data:
message: It finished
title: It finished
mode: single
Is the documentation incorrect/incomplete? Am I just not understanding it correctly? Is there another resource somewhere that goes into more detail on how these different structures interact with each other?