I have a sensor that I want o get the last time (hour and minutes) it was last trigged
{{ as_timestamp(states.binary_sensor.kattlucka_grovkok.last_changed) | timestamp_custom("%H:%M") }}
The template give me last time the sensors was trigged in hours and minutes in developer tools but when I but it as a sensor in my yaml file I get this error
Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: unexpected '%') for dictionary value @ data['sensors']['kattluckan']['value_template']. Got '{{ as_timestamp(states.binary_sensor.kattlucka_grovkok.last_changed)| timestamp_custom(%H:%M) }}'. (See ?, line ?).
This is my code
kattluckan:
value_template: "{{ as_timestamp(states.binary_sensor.kattlucka_grovkok.last_changed) | timestamp_custom("%H:%M") }}"
Please help me!