Card listing *devices* not entities?

I’m trying to make a card that shows all the devices in my Home Assistant that are not working. The problem is that many devices have a lot of entities, so if you just make a card that shows all unavailable entities, a single malfunctioning device will be very noisy. I have got a template that produces a list of the devices I want to display:

{% set device_ids = states
  | selectattr('state', 'in', ['unavailable', 'unknown'])
  | map(attribute='entity_id')
  | map("device_id")
  | map("string")
  | unique
  | select("ne", "None")
  | list
%}

{% for device_id in device_ids %}
  {{ device_attr(device_id, "name_by_user") or device_attr(device_id, "name") }}
{% endfor %}

And I can use a Markdown card to display them:

And I guess I could manually construct a link the device’s URL, like https://ha.local/config/devices/device/{deviceid}. But is there no official lovelace solution for dealing with devices, rather than entities?

2 Likes