Light Groups Not Working

Hi there,

I am trying to implement a light group, but it is not working. I would like to separate the groups from the cofiguraion.yaml. Here is my setup:

configuration.yaml:
packages: !include_dir_named integrations

in the folder integrations, I have a file: group.yaml with this content:
group: !include_dir_merge_named ../groups

in the folder …/groups I have a structure with the different groups in separate files. Here a eample:

- platform: group
  unique_id: lightgroup.moon
  name: IKEA Mond
  icon: mdi:lightbulb
  entities:
    - light.ikea_mond_1
    - light.ikea_mond_2

But this is not working. The group will not be created. Can some please help me to get this working?

Spartacus.

Take a look at your log and you probably will be able to see an error message related to this, which might give you some directions.

Anyway, this configuration you shared is not on group integration, so it should be outside your groups.yaml file, but under sensor on your configuration.yaml (or some of your packages files).

Like this:

light:
  - platform: group
    unique_id: lightgroup_moon
    name: IKEA Mond
    icon: mdi:lightbulb
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2

By the way, I’m not sure a “.” is valid for unique_id. Just in case I would try to replace this:

by this:

    unique_id: lightgroup_moon

If you want a group of lights, I’d recommend you use a light group instead, which you can set up in the UI instead of YAML.

2 Likes

Hello all,

thanks for the answer. Replacing lightgroup. moon with lightgroup_moon, does not help. The group is not visible in HA. When I enter lightgroups through the UI, they are defined as helpers. I have no idea how to split the different lightgroups into separate yaml files. If there is a way to do this, please let me know.

and btw: this is also nit working:

sensor:
  - platform: group
    unique_id: lightgroup_moon
    name: IKEA Mond
    icon: mdi:lightbulb
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2

“Package group setup failed. Component group cannot be merged. Expected a dict.”

I only have one line inthe configuartion.yaml:
packages: !include_dir_named integrations

In group.yaml I will load the different groups with:
group: !include_dir_merge_named ../groups

So something is wrong with my setup in the configuration.yaml and the group.yaml. I am confused now!

I only have one line inthe configuartion.yaml:

Well, for a start, your latest attempt is trying to add some light entities to a sensor group, which isn’t going to work.

Is there a reason you’re not simply setting it up in the UI, or using an actual light group?

light moon:
  - platform: group
    unique_id: lightgroup_moon
    name: IKEA Mond
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2

My fault!

I should have used the light domain, like this:

light:
  - platform: group
    unique_id: lightgroup_moon
    name: IKEA Mond
    icon: mdi:lightbulb
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2

What I do is creating a group file in configüration.yaml:
image
and then just make groups in groups.yaml:

Hi there,

i do this in order not to loose the overview. I have all my automations, entities, etc. in a folder structure. This works fine for everything, except groups.

When I change the code to this:

light:
  - platform: group
    unique_id: lightgroup_moon
    name: IKEA Moon
    icon: mdi:lightbulb
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2

the error is the same:
Package group setup failed. Component group cannot be merged. Expected a dict.

I tried to change the configuration in the group.yaml, but no clue, where I have to change what!

There are 2 types of groups:

  1. Old style groups
    Those will create an entity like group.lightgroup_moon and you can set like this:

If you want have it into configurations.yaml

group:
  lightgroup_moon:
    name: IKEA Mond
    icon: mdi:lightbulb
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2

If you want have it into groups.yaml

  lightgroup_moon:
    name: IKEA Mond
    icon: mdi:lightbulb
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2
  1. New style of groups
    Those will create entities from the same type of the child entities, but then you can ox mix types. A light group will be like light.lightgroup_moon and will behave like a light, so you will be able to set brightness, etc.
    Those groups can easily be created by the UI like announced here: 2022.4: Groups! Groups! Groups! - Home Assistant
    If you don’t want to use the UI, you can set it into your configuration.yaml (or in any package file, but not into the groups.yaml file you referenced above) like this:
light:
  - platform: group
    unique_id: lightgroup_moon
    name: IKEA Mond
    icon: mdi:lightbulb
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2

What I shared would go directly in configuration.yaml - but you should just do it in the UI

1 Like

In which file is this yaml? And how you make a reference to that on your configuration.yaml?

This is valid for the old style groups. Not for the new style groups.

Hi,

in configuration.yaml I have only one line:

packages: !include_dir_named integrations

in the integrations-folder I have all my config files, which are refering to a a folder structure:
example:
image

The content of the automations.yaml is like this:

automation: !include ../automations.yaml
automation split: !include_dir_list ../automations

HA runs to the folder structure in …/automations and includes all automations in the structure below …/automations.

Now I also want to do this for groups. But this produces the error above.

You can do that, but you have to understand a light group is different of a group with lights…

On groups.yaml you will create groups, which means entities named group.xxx. The format you used in your original post is incorrect, as that is the way of creating a light group (light.xxx) and cannot be inside groups.yaml.

So, in your package folder, create a file name lights.yaml with this content:

light:
  - platform: group
    unique_id: lightgroup_moon
    name: IKEA Mond
    icon: mdi:lightbulb
    entities:
      - light.ikea_mond_1
      - light.ikea_mond_2

Then restart your Home Assistant.

:wink:

If you want to do similarly, do like:

light: !include ../lights.yaml

And you can also use !include_dir_list ../lights in the same way, but it is important to understand that you very first post on this thread is a yaml to create a light, not to create a group, so it have to be under light: and not under group:.

I didn’t realize there different types.
What will be the difference?

ok, I think I have it! Groups and light-groups are different.
I changed the code in this way and HA did not report an error. But how can I access the Light-group now? There is nothing I can see in HA?

My expectation was, that I have a entity (or whatever) wich I can control? Where can I find the group “IKEA Mond” ?

See https://www.home-assistant.io/integrations/group

In short the new style groups behave as any standard entity in that domain, where the old style don’t.

If you created it under light then look in Developer Tools → States for light.lightgroup_moon

Thanks. I did check the group page.
It’s is all clear now.
I learned something today :sunglasses:

1 Like