I’m running on 0.57.2. I’m experiencing an issue with templating that I can’t seem to figure out. I’m receiving the following error message when I start up HA:
homeassistant.exceptions.TemplateError: UndefinedError: 'dict object' has no attribute 'state'
automations/automations_lights_on_at_sunset.yaml
alias: "lights_on_at_sunset"
trigger:
- platform: sun
event: sunset
offset: "-01:00:00"
condition:
condition: template
value_template: "{% if states('device_tracker.iphone1') == 'home' or states('device_tracker.iphone2') == 'home' %}true{% else %}false{% endif %}"
action:
- service: notify.ios_iphone
data_template:
message: >
{{ trigger.state.name }} is at home at sunset! Turning on interior lights!
What am I doing wrong? I’ve tried {{ trigger.state.name }}, {{ trigger.to_state.attributes.friendly_name }} and {{ trigger.state.attributes.friendly_name }} with no luck.