How would you replace this group

I currently use a bunch of groups, like this:

Buro:
  name: Büro
  entities:
    - switch.r1_licht
    - light.r1_lampen1
    - switch.r1_lampe2
    - input_boolean.buro_lampe
    - light.r1_schreibtischlampe
    - light.r1_led

This is perfect as I can control switches, lights and also my helpers, which are needed for some motion triggered lights. (They basically disable the motion triggered lights automations, and turn the light on) So if I turn off the group, it turns the whole room off and also enables the motion triggered automation.

I would really love to use the Matter Hub Addon to link to Alexa, but unfortunately the legacy group I’m using has no unique_id, so it isn’t picked up by the Matter Hub.

Has anyone the same problem and found a good solution?

Many thanks!

Try this one

  light:
  - platform: group
    name: "Büro"
    unique_id: 6fb5c826-b71e-4284-a753-573d314613b8
    entities:
       - switch.r1_licht
       - light.r1_lampen1
       - switch.r1_lampe2
       - input_boolean.buro_lampe
       - light.r1_schreibtischlampe
       - light.r1_led

This results in an error as the switch and the input_boolean are no light entities.

You need to convert them to light entities first. Depending on how the switches were added to home assistant you may be able to do this from the GUI:

You have the choice of hiding or keeping the switch entity.

If the integration you used to add the switch to HA does not have this then you can use a helper:

For the input_boolean you will have to use the template light integration:

Once all your entities are lights, then you can use the light group.

To be honest, this is so much more complicated than the legacy groups.

Ultimately I used this solution:
Mixed Entity Groups