alarm_arm_home:
alias: Alarm arm home
sequence:
- service: script.check_alarm_ready
- service: alarm_control_panel.alarm_arm_home
entity_id: alarm_control_panel.ha_rpi4_alarm
data:
code: !secret ha_alarm_panel_code
the script.check_alarm_ready is supposed to be called directly, meaning it should continue the calling script when not returned correctly Scripts - Home Assistant
since the script will continue after a sucessful wait, I would have thought this to work, but it doesn’t ( that is the script always continues, even after the timeout) and ask you to please have a look:
the script check_alarm_ready is:
check_alarm_ready:
alias: Check alarm ready
sequence:
# choose:
# doors_not_closed?
# notifiy doors not closed
# - wait until doors closed
# - continue
# doors_closed?
# continue
- choose:
- alias: Doors open
conditions: >
{{is_state('binary_sensor.doors','on')}}
sequence:
- service: notify.system
data:
title: Doors open
message: >
Can not Arm alarm because {{state_attr('sensor.doors','Doors')}}.
Please check.
- wait_template: >
{{is_state('binary_sensor.doors','off')}}
timeout:
minutes: 2
continue_on_timeout: false # this doesnt prevent the calling script from arming the alarm.....
default:
- service: notify.system
data:
title: Doors open
message: >
{{state_attr('sensor.doors','Doors')}}, arming alarm.
# - service: script.continue
Please have a look if you can help me sort this chooser?
thanks
When calling a script “directly” (e.g., script.NAME ) the calling script will wait for the called script to finish. If any errors occur that cause the called script to abort, the calling script will be aborted as well.
other than maybe setting an additional input_boolean, what would you suggest to stop the calling script?
what I did notice here, is that this is about the only place where it doesn’t matter if we quote the boolean on continue_on_timeout: or not.
(tested that just now because Wanted to make sure that wasn’t causing what I believed to be an issue.)oops. sorry bout that, was too long ago…
what I would love to do is create a notification upon the failure after timeout.
can we use the wait variable for that?
edit
guess not, so I had to take out the continue_on_timeout: false and add another chooser…
check_alarm_ready:
alias: Check alarm ready
sequence:
- choose:
- alias: Doors open
conditions: >
{{is_state('binary_sensor.doors','on')}}
sequence:
- service: notify.system
data:
title: Doors open
message: >
Can not Arm alarm because {{state_attr('sensor.doors','Doors')}}.
Please check.
- wait_template: >
{{is_state('binary_sensor.doors','off')}}
timeout:
minutes: 2
# continue_on_timeout: false
- choose:
- conditions: >
{{is_state('binary_sensor.doors','on')}}
sequence:
- service: notify.system
data:
title: Doors still open
message: >
Session expired: {{state_attr('sensor.doors','Doors')}}
default:
- service: script.alarm_ready
default:
- service: script.alarm_ready