Card to show offline devices?

I don’t know quite what to search for on this one but I’m sure there are already some topics so maybe someone could link to them or point me in the direction?

I’d like to have a card that dynamically lists certain devices if they have not had an updated for X minutes. And if there are no devices with issues then don’t show the card. Is this kind of thing possible?

For most entities, notably sensors, Home Assistant doesn’t monitor them for “no updates in X minutes”.
One exception is the MQTT Sensor which has an expire_after option. If the MQTT Sensor doesn’t receive an update within X minutes, its state value expires and becomes unavailable.

Some sensor integrations support the concept of availability (for the MQTT Sensor it’s the availability_topic). Once again, it will indicate unavailable if the device is no longer available (i.e. goes offline).

It’s possible to have a card display all entities whose state is unavailable. The challenge is that most entities don’t have the means of reporting they are unavailable if there are no updates within a desired time interval.

I’ve noticed that there is no “last update” attribute on sensors in dev tools. However, when you click on a card in lovelace and look at the history most have a last update time.

What is logging that state and could this be monitored? If you know there should be an update every x amount of time and it doesn’t happen.


An option that you could do is use the Ping sensor. Your question did say devices, so, assuming you can make a static IP for your devices in your router or you have a working Domain Naming Service for you LAN; you can easily do this for all your wifi devices.

If you have other networks like Zwave and Zigbee, it can be done but may not be easy: most device update on a change and at least once every 24hrs but some are only at a change of sensor state (rare but do exist).
This is just a small snippet of what I monitor for status.

How about the auto entity card:

This example shows all unavailable entities. I found it useful to check after system reboot or HA restart.

  title: Unavailable Entities
  type: glance
    - state: unavailable
show_empty: false
type: custom:auto-entities

If there is an attribute that says updated X minutes ago, you can change the filter to use that. But I don’t believe this attribute exists universally for all entities under the same attribute name.

I just noticed in the documentation for the auto-entity card, you can filter by last_updated. This should achieve what you want to do.


It’s not in the attributes of an entity’s State Object but a property of the object itself.

last_updated can be used to compute if an entity has not been updated in X minutes. However, that’s easily done for one entity, with a Template Sensor or Template Trigger in an automation, but messier if you want to use the same technique for many entities.

If the goal is to set the “dead” sensor’s value to unavailable then one would have to use a python_script to do it (like rodpayne’s because there is no native service to set a sensor’s state (plus the ‘forced’ new value will only last as long as the next restart).

1 Like

Best answer yet. :+1:

From here:

  • last_changed: Match minutes since last state change (most useful as a comparison, e.g. last_changed: < 15)
  • last_updated: Match minutes since last update

I use the Entity Filter card. Entities don’t show up when they are online.

Home Assistant card yaml :

type: entity-filter
  - binary_sensor.display_status
  - binary_sensor.bedside_lamp_status
  - binary_sensor.plug1_status
  - binary_sensor.plug2_status
  - binary_sensor.plug3_status
  - operator: '!='
    value: 'on'
  type: entities
  title: Disconnected devices

ESPHome yaml :

  - platform: status
    name: ${friendly_name} Status