I have a simplified a template that I'm building down to a close to bare minimum:
sensor:
- name: Test Notices
unique_id: eef5e218-4506-4b49-aba0-134c9e0fc5ff
state: 1
attributes:
notices: >
{{ {'alert': 'Snowfall warning', 'icon': 'mdi:alert-octogon'} }}
Using the template development tool the following snippet does not work as expected:
{% if state_attr('sensor.test_notices', 'notices').icon == 'mdi:alert-octagon' %}
Yeah!!
{% else %}
Huh?? >{{ state_attr('sensor.test_notices', 'notices').icon }}<
{% endif %}
I would have thought the compare would succeed. The code takes the else path and prints Huh?? >mdi:alert-octogon<.
Thanks for any insight!