Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to expand nested groups recursivly #423

Open
momonator25 opened this issue Feb 12, 2024 · 1 comment
Open

Add possibility to expand nested groups recursivly #423

momonator25 opened this issue Feb 12, 2024 · 1 comment

Comments

@momonator25
Copy link

momonator25 commented Feb 12, 2024

In my HA setup I have nested my sensors entities per type and area.
For example the group motion_sensors contains the different groups for the areas. To keep it simple I only take two in this example:

  • binary_sensor.motion_sensors
    • binary_sensor.motion_sensors_hallway
      • binary_sensor.motion_sensor_hallway_door
      • binary_sensor.motion_sensor_hallway_stairs
    • binary_sensor.motion_sensors_bedroom
      • binary_sensor.motion_sensor_bedroom_door
      • binary_sensor.motion_sensor_bedroom_bed

When I include

type: custom:auto-entities
card:
  type: entities
  title: Motion Sensors
filter:
  include:
    - group: binary_sensor.motion_sensors

I only see the two underlying entities:

  • binary_sensor.motion_sensors_hallway
  • binary_sensor.motion_sensors_bedroom

A possibilty to make auto-entities expand recursive groups would solve this problem.

EDIT:

Using wildcards to solve this doesn't work and gives no output

type: custom:auto-entities
card:
  type: entities
  title: Motion Sensors
filter:
  include:
    - group: "binary_sensor.motion_sensors_*"

EDIT 2:

From the docs I'm not shure if the entities option supports templating but it doesn't work for me:

type: custom:auto-entities
card:
  type: entities
  title: Motion Sensors
entities:
  template: "{{ expand('binary_sensor.motion_sensors') | map(attribute='entity_id') |  list }}"

Using a template to expand the group in the filter section this way doesn't work either for me:

type: custom:auto-entities
card:
  type: entities
  title: Motion Sensors
filter:
  include:
    - entities:
        template: |
          {{ expand('binary_sensor.motion_sensors') | map(attribute='entity_id') |  list }}

Running the template in the developer tools results in a list of the wanted entities which should work for the -entities in the include section :

[
  "binary_sensor.motion_sensor_bedroom_door",
  "binary_sensor.motion_sensor_bedroom_bed",
  "binary_sensor.motion_sensor_hallway_door",
  "binary_sensor.motion_sensor_hallway_stairs"
]

EDIT 3:

All Problems of EDIT 2 are solved by moving the template section directly under the filter and not in the include. So was my mistake. But this way I can't add options to the displayed entities:

type: custom:auto-entities
card:
  type: entities
  title: Motion Sensors
filter:
  template: "{{ expand('binary_sensor.motion_sensors') | map(attribute='entity_id') | list }}"
  include:
    options:
      secondary_info: last-changed
      state_color: true

EDIT 4:

Going the route over the domain and the attributes device_class leads to the problem that now also my groups are listed as seperate entries alongside with the sensors itself.

type: custom:auto-entities
card:
  type: entities
  title: Motion Sensors
filter:
  include:
    - domain: binary_sensor
      attributes:
        device_class: motion
@broyuken
Copy link

broyuken commented Jun 3, 2024

I would like to see a way to solve this as well. Currently I have a group called
light.all_lights
Inside that I have
light.upstairs_lights
light.downstairs_lights

Inside light.upstairs_lights I have
light.master_bedroom_lights

Inside that I have
light.master_bedroom_mirror_lightstrip
light.master_bedroom_bed_light_strip
light.master_bedroom_fan_light
so on and so forth. Then each room upstairs has its own list within it, then the same for downstairs.

As it stands now I would need to put each group individually in auto entities, or change it to domain: light and filter out some of the groups and random things that aren't actually lights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants