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.
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.
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 set_state.py) 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).