Groups entities parameters

I’ve have created groups in my groups.yaml file which contain a.mixture of (e.g. lights and switches).
Everything I have read so far indicates that any group should only contain the same type of entity but my mixed groups work OK.
Am I just lucky or is this something that home assistant does but is not made obvious?
A second puzzling thing is the ‘all: true’ parameter that I have in my groups.yaml file. This came from somebody’s yaml code, somewhere on the web but my understanding is this parameter says "all entities have to be ON for the group to turn ON’.
In my case, I use one of the group entities (a switch) to turn on or off the whole group - this works!
Again, am I just lucky or should my code actually be constructed somewhat differently?

Legacy groups (that support mixed domains) will continue to be supported but are discouraged. See https://www.home-assistant.io/integrations/group/#old-style-groups

Not sure why your “all” option is not working. Share your group config.

Hi tom_l,
Thanks for your reply.
My groups.yaml is -

LandingLightGroup:
  name: LandingLightGroup
  entities:
    - switch.l_l_switch_lower
    - switch.l_l_switch_upper
    - light.landing_light
  all: true
  
PassagewayLightGroup:
  name: PassagewayLightGroup
  entities:
    - switch.sonoff_1000f5c0ec_1
    - switch.sonoff_1000cd411f_3
  all: true
  
EnSuiteLightGroup:
  name: EnSuiteLightGroup
  entities:
    - switch.sonoff_1001131439
    - switch.sonoff_1001131a1e
  all: true

Bedroom2LightGroup:
  name: Bedroom2LightGroup
  entities:
    - light.bedroom_2_light
    - switch.bedroom_2_switch
  all: true
  
Bedroom4LightGroup:
  name: Bedroom4LightGroup
  entities:
    - light.bedroom_4_light
    - switch.bedroom_4_switch
  all: true

As an example of its use, in the LandingLightgroup, I have a script to trigger the whole group

landing_light_on:
  sequence:
  - service: homeassistant.turn_on
    data: {}
    target:
      entity_id: group.landinglightgroup
  mode: single
  icon: mdi:lightbulb-on-outline
  alias: landing_light_on_scr

which is there for use by Google Assistant.
Also, if either switch is triggered, I have an Automation which calls the above script -

id: '1647451677878'
  alias: landing_light_off_aut
  description: ''
  trigger:
  - platform: state
    entity_id: switch.l_l_switch_lower
    from: 'on'
    to: 'off'
  - platform: state
    entity_id: switch.l_l_switch_upper
    from: 'on'
    to: 'off'
  condition: []
  action:
  - service: script.landing_light_off
    data: {}
  mode: single'

This lot works exactly as I want it to. How would the preferred groups method work for the above situation? I’m happy to follow current practice, particularly if my method is actually going to be stopped from being used.
Finally, i don’t actually want the
all: true
line of code if it did what it is supposed to do (because I want any entity in the group to trigger the group). Maybe having that line and my mixing entities is making the script run how I want, even if it’s not how it’s supposed to work! Not a criticism, just an observation.

Then remove it. The default is all: false

Then you will have to list the entities as separate triggers for your automation. Neither all true nor all false will be able to do this (one will not work for turn on, one will not work for turn off). The other option is a template trigger that expands the group, which I believe is available for both legacy and new groups.

To use the new groups, you would have to convert one switch to a light using the “Switch as x” helper. Then you could use a Light group. The new groups are single domain (you can’t mix switches and lights). Or (like me) you can just keep using the legacy groups hoping that something suitable becomes available.

OK. I’ve removed the all:true line completely - my script and automation still work.
I mislead you slightly in my earlier post - when I said I want all entities to trigger the group, I meant all the switches (not the light).
As my configuration is working, it seems more complicated (not by much, though) to have extra code to do the switch to light conversion to achieve my results.
Is the groups.yaml file option going to be removed or can I carry on using it the way I am doing now?

Never say never (there is a lot of developer dislike for it) but as we don’t really have a viable alternative I don’t see it being depreciated any time soon.

Brilliant!
Thanks tom_l.
I will carry on regardless!

Hi @PaulLeadbeater I tried to replicate this by creating a group made up of lights and a switch in groups.yaml. However, I don’t see the group in my entities on the GUI. How do I make the group appear as an entity so I can use it in an automation/scene

Here’s my code for this in case I’ve missed something.

 # Sonos Power Group
SonosPowerG:
  name: Sonos Power 2 Group
  entities:
    - light.tz3000_cfnprab5_ts011f_light
    - light.tz3000_cfnprab5_ts011f_light_2
    - light.tz3000_cfnprab5_ts011f_light_7
    - switch.living_room_right_sonos_switch

Thanks for the help.

You have missed that slugs must be lower-case. You have used camel-case. Try this instead:

# Sonos Power Group
sonos_power:
  name: Sonos Power 2 Group
  entities:
    - light.tz3000_cfnprab5_ts011f_light
    - light.tz3000_cfnprab5_ts011f_light_2
    - light.tz3000_cfnprab5_ts011f_light_7
    - switch.living_room_right_sonos_switch