#When it comes to customizing cards or
1 messages · Page 1 of 1 (latest)
@paper matrix (Note: for some reason, the UI "collapses" the secondary section so it won't be pretty but still works.)
type: custom:mushroom-template-card
secondary: >
{% set t = (as_timestamp(now()) - as_timestamp(state_attr('sensor.persistence_tracker','changes')[entity] )) | int %}
{% if t < 60 %} Less than a minute
{% elif t < 3600 %} {{ t // 60 }} min
{% elif t >= 3600 %} {{ t // 3600 }} hr {{ (t % 3600) // 60 }} min
{% else %} error
{% endif %}
entity: light.bedroom_lights
primary: |
Front Door: Currently {{ ((states(entity)) == 'on') | iif("open", "closed") }}.
icon: |
{{ ((states(entity)) == 'on') | iif("mdi:door-open", "mdi:door-closed") }}
icon_color: |
{{ ((states(entity)) == 'on') | iif('red', 'green') }}```
Thanks for sharing and helping, I'll try it out
You'll probably have to fiddle with this part a bit. It was unique to what I was working on at the time and I'm drawing a blank on the proper syntax.
as_timestamp(state_attr('sensor.persistence_tracker','changes')[entity] ))
Appreciated 👍