Group, Configuration, & Light Group

I want to “group” some ceiling lights so that I can turn them all on & off with one dashboard “button”.

The Light Group page https://www.home-assistant.io/integrations/light.group/ suggests I should group the entities with configuration.yaml

But if so, what is the groups.yaml file for?

I have tried putting this in configuration.yaml, but it doesn’t work.

light:
  - platform: group
    name: Office Ceiling Lights1
    entities:
      - light.bulb_n
      - light.bulb_22
      - light.bulb_32
      - light.bulb_42
      - light.bulb_52
      - light.bulb_S2
      - light.yellow
      - light.green

Nor does this work within group.yaml.

group:
  office:
    name: Office Ceiling Lights2
    entities:
      - light.bulb_n
      - light.bulb_22
      - light.bulb_32
      - light.bulb_42
      - light.bulb_52
      - light.bulb_S2

Many thanks!

Light groups and groups are not the same.
The first example you show is correct for creating a light group.

Do you have any errors under Configuration -> Logs?

Make sure that you have light: only once in configuration.yaml. everything needs to be im one light: section.

Thanks for the clarification @Burningstone , very helpful.

Having removed the all text in the groups.yaml file & re-started HASS, there are no errors in the logs (but before there were these two if relevant).

Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:420 
Integration: Home Assistant Supervisor (documentation, issues) 
First occurred: 10:08:57 (13 occurrences) 
Last logged: 12:42:10

Invalid config for [scene]: [show_state] is an invalid option for [scene]. Check: scene->states->0->show_state. (See /config/configuration.yaml, line 11).
Invalid config for [scene]: [show_state] is an invalid option for [scene]. Check: scene->states->0->show_state. (See /config/configuration.yaml, line 11). Invalid config for [group]: value should be a string for dictionary value @ data['group']['light']['entities']. Got None. (See /config/configuration.yaml, line 8).
Invalid config for [scene]: [show_state] is an invalid option for [scene]. Check: scene->states->0->show_state. (See /config/configuration.yaml, line 11). Invalid config for [group]: [office] is an invalid option for [group]. Check: group->group->group->office. (See /config/configuration.yaml, line 8).
Invalid config for [scene]: [show_state] is an invalid option for [scene]. Check: scene->states->0->show_state. (See /config/configuration.yaml, line 11). Invalid config for [group]: [office] is an invalid option for [group]. Check: group->group->group->office. (See /config/configuration.yaml, line 8). Invalid config for [light]: string value is None for dictionary value @ data['platform']. Got None. (See /config/configuration.yaml, line 26).

Line 11 in my configuration.yaml is
script: !include scripts.yaml

Logger: homeassistant.config
Source: config.py:415 
First occurred: 10:05:12 (56 occurrences) 
Last logged: 12:42:10

Invalid config for [automation]: required key not provided @ data['action'][0]['domain']. Got None required key not provided @ data['trigger'][0]['platform']. Got None. (See /config/configuration.yaml, line 9).
Invalid config for [automation]: Unexpected value for condition: 'None'. Expected numeric_state, state, sun, template, time, zone, and, or, not, device @ data['condition'][0]. Got None Unexpected value for condition: 'None'. Expected numeric_state, state, sun, template, time, zone, and, or, not, device @ data['condition'][1]. Got None. (See /config/configuration.yaml, line 9).
Invalid config for [automation]: [volume_level] is an invalid option for [automation]. Check: automation->action->1->volume_level. (See /config/configuration.yaml, line 9).
Invalid config for [automation]: extra keys not allowed @ data['action'][0]['brightness_pct']. Got None extra keys not allowed @ data['action'][0]['domain']. Got None extra keys not allowed @ data['action'][0]['type']. Got None required key not provided @ data['trigger'][2]['platform']. Got None. (See /config/configuration.yaml, line 9).

This is my configuration file (with line numbers inserted here for ease). Does anything look wrong?

TIA

1
2# Configure a default setup of Home Assistant (frontend, api, etc)
3default_config:
4
5# Text to speech
6tts:
7  - platform: google_translate
8
9group: !include groups.yaml
10automation: !include automations.yaml
11script: !include scripts.yaml
12scene: !include scenes.yaml
13
14cover:
15  - platform: brunt
16    username: !secret brunt_user
17    password: !secret brunt_pw
18    
19  - platform: opengarage
20    covers:
21      garage:
22        host: 192.168.2.80
23        device_key: !secret opengarage
24        name: Garage Door
25        
26light:
27  - platform: group
28    name: Office Ceiling Lights1
29    entities:
30      - light.bulb_n
31      - light.bulb_22
32      - light.bulb_32
33      - light.bulb_42
34      - light.bulb_52
35      - light.bulb_S2
36      - light.yellow
37      - light.green
38        

i am managing my light groups in a seperate file. under light: in configuration.yam i am using this to redirect:

light groups: !include light-groups.yaml

the light-groups.yaml is looking like that.

# Light Group
- platform: group
  name: Bad 1OG
  entities:
    - light.bad1
    - light.bad2
    - light.bad3
    - light.bad4
- platform: group
  name: Flur 2OG
  entities:
    - light.flur_2og_1
    - light.flur_2og_2
- platform: group
  name: Küche
  entities:
    - light.kuche1
    - light.kuche2
- platform: group
  name: Wohnzimmer
  entities:
    - light.todesstern
    - light.tv_wz_led
    - light.blackball
    - light.esstisch
- platform: group
  name: Schlafzimmer
  entities:
    - light.bett
- platform: group
  name: Kinderzimmer
  entities:
    - light.panel_l
    - light.panel_n
    - light.panel_t

I don’t see anything wrong in your configuration.yaml.

The errors you showed refer to the contents of scene.yaml and automation.yaml.

So with this configuration.yaml you don’t see a new entity called light.office_ceiling_lights1 under Developer Tools -> Entities?

Not sure what happened, but it is now working - so thanks very much for your help!

I see it’s working now, but for clarification:
If you use seperate files for grouping (like group.yaml or lights.yaml) you shouldn’t put groups: or lights: in there at the beginning.

2 Likes

Group A (view this as “all lights”)
Light 1
Light 2
Light 3
Light 4
Light 5
Light 6

Group B (two selected light, lets say “window lights in bedroom”)
Light 1
Light 2

Now, if i toggle Group B, Group A also shows state “on”.
How can I mitigate this?

I believe this is not to avoid, since two of its lights are “on”.
Not sure if it would make sense, but you can remove Light 1 and 2 from Group A and create an automation which switches Group B when Group A is switched.

1 Like

Thanks for this. Was banging my head against the wall trying to figure out how my yaml syntax was broken, I just needed to remove my first line, “group:”, since I’m working with the imported groups.yaml instead of directly in configuration.yaml.