Good morning.
I’ve a problem with button card and as_time stamp:
In The administrative tools → models
{{as_timestamp(states['sensor.record_temperatura_massima'].attributes.quando) | timestamp_custom('%d/%m/%Y alle ore: %H:%M')}}
working fine.
this is an excerpt of the code of an advanced button card
[...]
info2: |
[[[
return `<ha-icon
icon="mdi:calendar"
style="width: 12px; height: 12px; color: white;">
</ha-icon><span> registrata il: <span style="color: var(--text-color-sensor);">${states['sensor.record_temperatura_massima'].attributes.quando}%</span></span>`
]]]
[...]
works but in agreement with the “quando” attribute, the output is a unformatted timestamp
Why this not working (the button disappear)
[...]
info2: |
[[[
return `<ha-icon
icon="mdi:calendar"
style="width: 12px; height: 12px; color: white;">
</ha-icon><span> registrata il: <span style="color: var(--text-color-sensor);">${as_timestamp(states['sensor.record_temperatura_massima'].attributes.quando) | timestamp_custom('%d/%m/%Y alle ore: %H:%M')}%</span></span>`
]]]
[...]
Thanks