Better way to highlight offline devices?

I currently have a card that shows all my Aqara temp sensors and when they last got updated. Is there any way to change their icon or do something to easily spot those that have not had an update in the last hour?
Better yet, is there any kind of card that would JUST display specific entities that have not receive an updated for an hour?

1 Like

I think you can do that with custom-auto-entities. I have done almost the same thing, sorting my sensors from the oldest to the most recent ‘last_seen’ status. I’m pretty sure you can display only the ones over a threshold…

1 Like

Cool! Any change you could share some code as inspiration?

Sure… Here is my code:

type: custom:stack-in-card
mode: vertical
cards:
  - type: custom:auto-entities
    card:
      type: entities
    entities:
      - type: divider
      - entity: sensor.0x00158d0003cef8cf_temperature
        type: custom:template-entity-row
        state: >-
          {{ states('sensor.0x00158d0003cef8cf_temperature') | round(1) }} °C /
          {{ states('sensor.0x00158d0003cef8cf_humidity') | round(1)}} %
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('sensor.0x00158d0003cef8cf_temperature',
          'last_seen'))))  }} ago
      - entity: sensor.0x00158d0002387b54_temperature
        type: custom:template-entity-row
        state: >-
          {{ states('sensor.0x00158d0002387b54_temperature') | round(1) }} °C /
          {{ states('sensor.0x00158d0002387b54_humidity') | round(1)}} %
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('sensor.0x00158d0002387b54_temperature',
          'last_seen'))))  }} ago
      - entity: sensor.0x00158d0002391b7e_temperature
        type: custom:template-entity-row
        state: >-
          {{ states('sensor.0x00158d0002391b7e_temperature') | round(1) }} °C /
          {{ states('sensor.0x00158d0002391b7e_humidity') | round(1)}} %
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('sensor.0x00158d0002391b7e_temperature',
          'last_seen'))))  }} ago
      - entity: sensor.0x00158d00044617ea_temperature
        type: custom:template-entity-row
        state: >-
          {{ states('sensor.0x00158d00044617ea_temperature') | round(1) }} °C /
          {{ states('sensor.0x00158d00044617ea_humidity') | round(1)}} %
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('sensor.0x00158d00044617ea_temperature',
          'last_seen'))))  }} ago
      - entity: sensor.0x00158d0003cef857_temperature
        type: custom:template-entity-row
        state: >-
          {{ states('sensor.0x00158d0003cef857_temperature') | round(1) }} °C /
          {{ states('sensor.0x00158d0003cef857_humidity') | round(1)}} %
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('sensor.0x00158d0003cef857_temperature',
          'last_seen'))))  }} ago
      - entity: sensor.0x00158d00044b860f_temperature
        type: custom:template-entity-row
        state: >-
          {{ states('sensor.0x00158d00044b860f_temperature') | round(1) }} °C /
          {{ states('sensor.0x00158d00044b860f_humidity') | round(1)}} %
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('sensor.0x00158d00044b860f_temperature',
          'last_seen'))))  }} ago
    sort:
      method: attribute
      attribute: last_seen
  - type: custom:auto-entities
    card:
      type: entities
    entities:
      - type: divider
      - entity: binary_sensor.0x00158d000257a823_occupancy
        type: custom:template-entity-row
        name: Basement Motion occupancy
        icon: mdi:walk
        state: >-
          {% if is_state('binary_sensor.0x00158d000257a823_occupancy',
          'off')%}Clear{% else %}Detected{% endif %}
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('binary_sensor.0x00158d000257a823_occupancy',
          'last_seen'))))  }} ago
      - entity: binary_sensor.0x00158d0002e24b7f_occupancy
        type: custom:template-entity-row
        name: Front Door Motion occupancy
        icon: mdi:walk
        state: >-
          {% if is_state('binary_sensor.0x00158d0002e24b7f_occupancy',
          'off')%}Clear{% else %}Detected{% endif %}
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('binary_sensor.0x00158d0002e24b7f_occupancy',
          'last_seen'))))  }} ago
      - entity: binary_sensor.0x00158d0002e3572f_occupancy
        type: custom:template-entity-row
        name: Garage Motion occupancy
        icon: mdi:walk
        state: >-
          {% if is_state('binary_sensor.0x00158d0002e3572f_occupancy',
          'off')%}Clear{% else %}Detected{% endif %}
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('binary_sensor.0x00158d0002e3572f_occupancy',
          'last_seen'))))  }} ago
    sort:
      method: attribute
      attribute: last_seen
  - type: custom:auto-entities
    card:
      type: entities
    entities:
      - entity: sensor.0x04cf8cdf3c7b2ea5_illuminance
        type: custom:template-entity-row
        name: Family room Light illuminance
        icon: mdi:brightness-5
        state: '{{ states(''sensor.0x04cf8cdf3c7b2ea5_illuminance'') }}'
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('sensor.0x04cf8cdf3c7b2ea5_illuminance',
          'last_seen'))))  }} ago
      - entity: sensor.0x04cf8cdf3c7d1ff7_illuminance
        type: custom:template-entity-row
        name: TV Light illuminance
        icon: mdi:brightness-5
        state: '{{ states(''sensor.0x04cf8cdf3c7d1ff7_illuminance'') }}'
        secondary: >-
          {{ (
          relative_time(as_datetime(state_attr('sensor.0x04cf8cdf3c7d1ff7_illuminance',
          'last_seen'))))  }} ago
    sort:
      method: attribute
      attribute: last_seen

I hope it helps…

1 Like