I am experimenting with the newly introduced variables and am having problems understanding where they can be used. E.g., in a script sequence:
- variables:
home: '{{ (states("group.familie") == "home") }}'
time: '{{ now().strftime("%H:%M:%S") }}'
daytime: '{{ (time > states("input_datetime.off")) and (time < states("input_datetime.on")) }}'
armed: '{{ states("alarm_control_panel.home") == "armed_away" }}'
expressions works perfectly fine (e.g. time is used and resolved in daytime). However it seems that using them in statements:
service_to_call: >-
{% if (home and daytime and armed) %}
alarm_control_panel.alarm_disarm
{% elif (((not home) or (not daytime)) and (not armed)) %}
alarm_control_panel.alarm_arm_away
{% else %}
script.noop
{% endif %}
doesn’t seem to resolve them properly or at all. In this case the ‘if’ branch is always true.
I’m dumping the content of the variables into the log file within the actions and the variables all have the expected values.
Do I miss anything or I am I completely misunderstanding how to use variables?