Auto entities only open doors or windows

I am trying to create a vertical stack card, using auto-entity cards, to show:

  1. Only lights which are on
  2. Only batteries which are low, and
  3. Only doors or windows which are open

The first two appear to work (although I have no low batteries at the moment), but the third is only populated by one entity, even though I know other doors are open.
Can anyone tell me what I am doing wrong - I am still pretty new to HA.
The code is (the whole card, although I guess you can skip down to the third card only, which I have moved down one line here just to help visually)

type: vertical-stack
cards:
  - type: custom:auto-entities
    card:
      title: Lights On
      type: grid
      columns: 1
      square: false
    card_param: cards
    filter:
      include:
        - domain: light
          state: 'on'
          options:
            type: custom:mushroom-light-card
      exclude: []
    show_empty: false
  - type: custom:auto-entities
    card:
      show_header_toggle: false
      title: Low Batteries
      type: entities
    filter:
      include:
        - attributes:
            device_class: battery
          state: <= 10
      exclude:
        - name: /[Ll]ow/
        - name: /[Ss]tate/
    sort:
      method: state
      numeric: true
  - type: custom:auto-entities
    card:
      show_header_toggle: false
      title: Open Doors and Windows
      type: entities
    filter:
      include:
        - domain: binary_sensor
          state: 'on'
          attributes:
            device_class: window
        - domain: binary_sensor
          state: 'on'
          attributes:
            device_class: door

I have created a group for all door and window sensors:

binary_sensor.contact_sensors

Would it be better / possible to use this instead, although the status of this is “on”, which I assume derives from the fact that one or more of the sensors is on.

Thank you

1 Like

Try this:

    filter:
      include:
        - domain: binary_sensor
          state: 'on'
          attributes:
            device_class: window
            device_class: door
1 Like

Thank you so much Tom
I think I am still getting something wrong as I get an error message:

Configuration errors detected:
duplicated mapping key (12:9)

The revised code I have is now:

type: custom:auto-entities
card:
  show_header_toggle: false
  title: Open Doors and Windows
  type: entities
filter:
  include:
    - domain: binary_sensor
      state: 'on'
      attributes:
        device_class: window
        device_class: door

Have I mis-copied ?

1 Like

Found it
No idea why but many of the aqara sensors I have used have a device class “opening”. Others have “door” or “window” as the class.

1 Like

I was looking for information on how to do this. Thanks to both of you for the information!