the problem i wanted to solve was this: i use a manual alarm control panel, and its state isn’t persistent on restart. so i have a separate input_select that tracks the alarm state, and i restore like this:
- alias: restore alarm state on startup
trigger:
platform: homeassistant
event: start
action:
service_template: >
{%- if is_state('input_select.alarm_mode', 'armed_away') -%}
script.arm_away_alarm
{%- elif is_state('input_select.alarm_mode', 'armed_home') -%}
script.arm_home_alarm
{%- endif %}
i’ve tested it a few times, and it works fine. but is it guaranteed to work? i.e. is there a chance this will run before the state of input_select.alarm_mode has been restored? should i put in a delay to be safe? delays aren’t ideal since the sooner the alarm is set, the better of course.