How to list all zigbee2mqtt offline devices?

According to zigbee2mqtt Device-Availability | Zigbee2MQTT

The availability feature checks whether your devices are online. The availability state of a device is published to zigbee2mqtt/[FRIENDLY_NAME]/availability with payload {"state":"online"} or {"state":"offline"} (this message is a retained MQTT message).

Then, how to create a card that shows all of the state:offline devices?

I was able to arrive at


{% for entity in states if entity.state == 'unavailable' %}
**{{ entity.entity_id }}**: {{ entity.state }}
{% endfor %}

but this is for entities, not devices. So it lists a lot of stuff. I only wanted to know about devices, but MQTT exports entities, not devices I guess

Generally speaking, a “device” is just a container of “entities” in HA. There is no notion of a device being unavailable.

did you find a solution? I’m also looking for it