Introduced with the new HA core version 2021.4 we now get warnings for undefined variables (https://www.home-assistant.io/blog/2021/04/07/release-20214/#warnings-for-undefined-variables-in-templates ). This is good, in the sensors you can change is by other formatting → state_attr…etc.etc.
In some of my automations I get also this warning, but I cannot find a way to reformat the syntax.
I now have:
trigger:
- entity_id: sensor.traveltime_home
value_template: '{{ state.attributes.duration }}'
platform: numeric_state
above: 45
This does not work;
trigger:
- entity_id: sensor.traveltime_home
value_template: '{{state_attr("duration")}}'
platform: numeric_state
above: 45
Any tips on how to reformat??