Glance card for all entities with a certain device class?

Is there any way to specify the list of entities for a glance card by the device_class attribute?

I want to list all the entities with the device_class ‘opening’ so I can see at a glance which windows are open.

I can use the entity_filter card but I’d have to list all the entities manually and then filter on if it’s open or not, but I prefer to be able to see all the devices all the time, that way I learn that the top left is the back door, for example, and I find that faster than reading the name.

So in short I want to be able to populate the list of entities for a glance card using a template, like this one I can paste into the dev tool:

{{ states.binary_sensor
       | selectattr('attributes.device_class', 'eq', 'opening')
       | map(attribute='name')
       | list }}

The auto-entities custom card from HACS is the answer to this.
Here’s some config that shows the state of all the sensors that my alarm listens to when activated so I can see at a glance which windows have been left open.

card:
  type: glance
type: custom:auto-entities
filter:
  include:
  - domain: binary_sensor
    attributes:
      device_class: door
  - domain: binary_sensor
    attributes:
      device_class: window
  - domain: binary_sensor
    attributes:
      device_class: opening
2 Likes