Add domain specific groups to group services

It would be nice if we could dynamically create domain specific groups like we can create group entities.

Maybe it would be possible to add the exisitng service calls with an optional domain setting to create e.g. a light group

So something like this.

service: group.set
data:
  domain: light
  object_id: test_light_group
  name: My test light group
  icon: mdi:light-group
  entities: light.entity_id1, light.entity_id2

This would allow to create groups which automatically update.

Example automation using this:

trigger:
  - platform: template
    value_template: >
      {{
        state_attr('light.kitchen_lights', 'entity_id') | count
        != expand(area_entities('kitchen')) | selectattr('domain', 'eq', 'light')
                                            | rejectattr('attributes.entity_id', 'defined')
                                            | list | count
      }}
action:
  - service: group.set
    data:
      domain: light
      object_id: kitchen_lights
      name: Kitchen Lights
      icon: mdi:light-group
      entities: >
        {{
          expand(area_entities('kitchen')) | selectattr('domain', 'eq', 'light')
                                           | rejectattr('attributes.entity_id', 'defined')
                                           | map(attribute='entity_id')
                                           | list
        }}

Don’t forget to vote for your own request Fes.

Thanks! Did that now

I make heavy use of the group.set service, so I’m always interested in enhancements. If I use


    - service: group.set
      data:
        object_id: auto_group_lamps
        name: 'Lampen (auto)'
        icon: mdi:lightbulb-on-outline
        entities: |
            {{ states.light
              |rejectattr('attributes.is_hue_group', 'true')
              |rejectattr('attributes.entity_id', 'defined')
              |selectattr('state', 'eq', 'on')
              |map(attribute='entity_id')
              |list
            }}

(triggered by a sensor thats monitors on/off states) I get a group that only contents lights that are on.

Would you please give me a hint what’s the advantage of your request?

My request would allow to create a domain specific group, for example a light group, which will actually be a light entity and not a group entity. This wil also allow to set brightness and color temperature for the group members (for those group members which support this).

1 Like

Oh, you’re right. I never noticed it :see_no_evil: That makes total sense.

has this been implemented?

No.

It would be very nice to get this, so we could control devices in domain specific group using voice assistant.

Old-style groups can not have unique_id and thus can not have alias. That makes it unable to be controlled by the voice assistant with different languages.

domain specific groups can have a unique id, I don’t see any relation with this request to controlling domain specific groups using Assist.

You can not set aliases for legacy groups (and therefor for mixed groups)

Yup, that’s correct. Domain specific groups work with Assist. However mambership management of domain specific group must be manual. That is, whenever a new light is added to Home Assistant, then it needs to be manually added to the domain specific group.

Legacy groups have group.set service call, which can be used to automatically update group membership. But such group can not be used in Assist.

1 Like