Hello i’m trying to figure out how to template automation conditions. The conditions should be based on the automation trigger. When i check the config i don’t see any errors. However the automation doesn’t fire. Can anyone help me out with this?
- alias: Stekker bed uit wanneer iemand vertrekt in de ochtend
trigger:
- platform: state
entity_id: group.glenn
from: 'home'
to: 'not_home'
for:
seconds: 30
- platform: state
entity_id: group.ellen
from: 'home'
to: 'not_home'
for:
seconds: 30
condition:
condition: and
conditions:
- condition: state
entity_id: sensor.partofday
state: 'Ochtend'
- condition: template
value_template: >
{% if trigger.entity_id == 'group.glenn' %}
is_state('switch.bed_glenn', 'On')
{% else %}
is_state('switch.bed_ellen', 'On')
{% endif %}
action:
- service: switch.turn_off
data_template:
entity_id: >
{% if trigger.entity_id == 'group.glenn' %}
switch.bed_glenn
{% else %}
switch.bed_ellen
{% endif %}
- service: notify.pushover
data_template:
message: >
{% if trigger.entity_id == 'group.glenn' %}
Stekker bed Glenn uitgeschakeld.
{% else %}
Stekker bed Glenn uitgeschakeld.
{% endif %}
I’m looking to get this part of the automation working. When I comment this out. Everything is working fine.
- condition: template
value_template: >
{% if trigger.entity_id == 'group.glenn' %}
is_state('switch.bed_glenn', 'On')
{% else %}
is_state('switch.bed_ellen', 'On')
{% endif %}