I’m trying to use the ‘etd’ state of a train in an automation that messages me if it’s not ‘On time’.
That state seems to be from an attribute dictionary.
So far I can see the state reported correctly in Template Tools using:
{{ state_attr('sensor.trains_colchester_to_chelmsford_20m_walk', 'service')['etd']}}
In the automation I can get it to message me for a specific train by referencing the entity state:
metadata: {}
data:
message: >-
{% if is_state('sensor.trains_colchester_to_chelmsford_20m_walk', '08:54')
%}The trains are fine{% else %} {{
states('sensor.trains_colchester_to_chelmsford_20m_walk') }} {% endif %}
action: notify.mobile_app_nicks_iphone
But I can’t get the if statement to be dependent on the ‘etd’ attribute value.
How would I write the if statement in the message to use ‘etd: On time’?