Automatically create groups based on some conditions (ie name, area)

There’s this wonderful project auto-entities, GitHub - thomasloven/lovelace-auto-entities: 🔹Automatically populate the entities-list of lovelace cards, that allows to display entities based on a query like so:

filter:
  include:
    - name: "Bedroom *"
    - entity_id: "sensor.temperature_*_max"

What would be really interesting is to have the ability to do the same thing for groups… for example

main_bathroom_switch_group:
  name: Bathroom Lights Group
  entities:
    - switch.main_bathroom_exhaust_fan
    - light.main_bathroom_vanity_lights

laundry_room_switch_group:
  name: Laundry Room Lights Group
  entities:
    - switch.laundry_room_main_lights
    - light.laundry_room_whisper_light

garage_switch_group:
  name: Garage Lights Group
  entities:
    - switch.garage_main_lights
    - light.garage_outlet

these groups follow the nomenclature: ‘object_type’.‘room_name’_entity_non_friendly_name.

would be so cool to be able to make groups like this…

Similarly lovelace-ui.yaml seems to have a way to list entities in a room… (actually haven’t figured out how it does it yet, since you can’t pick entity attributes with room name/id)

I found in a custom package somewhere a working example

where they use “group_set” and automation every minutes to update a group list.

Anyone knows a better way to accomplish this?

3 Likes

Did you ever find a solution for this. I would like to generate groups of light based on the “area” of the device.

bathroomlightgroup:
  entities:
    - light.* with area set to bath
3 Likes

same here. anyone has a hint on how to solve this? thanks

I’ve not had time to actually try this… my current work around is to use auto-entities and display lights by rooms instead of making a group… it serves the same purpose…

at least this way when I add a light to the living room I don’t have to change anything on the dashboard…

But i’m still interested in getting this done… surprised more people aren’t curious about this…

  - type: "custom:button-card"
    template: card_title
    label: Lights
  - type: custom:auto-entities
    card:
      type: grid
      columns: 2
      square: false
    card_param: cards
    filter:
      include:
        - domain: light
          area: Living Room
          options:
            type: "custom:button-card"
            template: card_light_slider_collapse
            variables:
              ulm_card_light_enable_slider: true
              ulm_card_light_enable_collapse: true
        - domain: switch
          area: Living Room
          entity_id: /^.*light.*$/
          options:
            type: "custom:button-card"
            template: card_light_slider_collapse
            variables:
              ulm_card_light_enable_slider: true
              ulm_card_light_enable_collapse: true
2 Likes

can you post your button-card template yaml ? i really like this look !

yeah, i love auto-entities (UI)

i’d love same for the groups + easier automations for bulk group actions (backend)

Have you seen this?

And in combination with this:

respective this

you could even build a dashboard input to dynamicly create group helpers for rooms, stages, devices, labels. I think even wildcards where possible

IIUC you’re suggesting running a script from the dashboard, whereas it fires the blueprint… not sure I follow? Might need a bit more time to digest this, but would appreciate if you can tldr it for me…