Having trouble finding a way to leverage this template into a custom field in Custom Button card.
For instance, this is the template that works in Dev Tools
{{ as_timestamp (states.sensor.device.last_changed) | timestamp_custom('%H:%M',True) }}
Normally in Custom Button card I can do the following to get the state. However it does not like the as_timestamp portion, nor does it respect attributes.last_changed either. Any suggestions?
custom_fields:
changed: |
[[[
var changed = states['sensor.device'].state;
return (changed ? changed : '0');
]]]