Hey!
I just experienced that some of my temperature sensors went down, without me knowing about it - since they got stuck at the last value read.
So, to fix this - i wan’t a “panel” where u can see when they last updated and the battery state. Said and done, as the picture shows.
But here’s the problem - since it’s easy to miss if it says “1 day ago” or “1 hour ago” i wan’t the secoundary text to be red if it’s been over 12h since last update.
I have tried multiple codes getting this to work, but i can’t seem to get it working.
The last code i have tried is this one;
type: entities
entities:
- entity: sensor.badrum_temperature
type: custom:multiple-entity-row
name: Tempgivare Hall
secondary_info: last-changed
show_state: false
entities:
- entity: sensor.tempgivare_hall_batteri
name: Batteri
style:
'--secondary-text-color': >
{% set last_updated = state_attr('sensor.badrum_temperature', 'last_updated') %}
{% set time_difference = (now() - last_updated).total_seconds() / 60 %}
{% if time_difference > 2 %}
red
{% else %}
inherit
{% endif %}
But it won’t work, i also tried just
style:
'--secondary-text-color': red
But it still won’t change the colour to red.
Thankful for all the help i can get!