Are Light groups screwy or is it just me?

I have been fighting this for days. Below is part of my entry in my lights.yaml. Everything works fine EXCEPT the basement track lights switch to light does not work at all. The others work fine and can be grouped and are operational. The Basement Light Group works, except for the track lights. Please help me see what is wrong here!

  - platform: switch
    name: Laundry Room Fluorescent
    entity_id: switch.laundry_room_fluorescent
  - platform: switch
    name: Basement Work Light
    entity_id: switch.basement_work_light_switch
  - platform: switch
    name: Basement Track Lights
    entity_id: switch.basement_track_lighting_switch
  - platform: group
    name: Laundry Room Light Group
      - light.laundry_room_south_light_bulb
      - light.laundry_room_center_light_bulb
      - light.laundry_room_north_light_bulb
      - light.laundry_room_fluorescent
  - platform: group
    name: Basement Light Group
      - light.basement_track_lights
      - light.basement_east_light_bulb
      - light.basement_west_light_bulb
      - light.basement_work_light

Please edit your post and format your pasted config correctly. See point 11 here.

Thanks, first time posting, so now I know!

Your config looks ok. Look in the developer tools /states menu. Is the state of light.basement_track_lights available?

Is it spelled correctly?

Can you control it individually (not using the group)?

The switch.basement_track_lighting_switch is available and is operational. It’s like it never got converted to a light. device. I have tried removing it entirely and re-entering it. Afterwards I would reload the groups and even re-started HA. The rest of the group has no problems, just this one switch to light definition.
I have checked the spelling, etc. Is there a limit to the number of Switch to Light conversions in a lights.yaml file?

No limit you would ever reach.

These two things don’t look the same to me. In your group you specify light.basement_track_lights yet you mention that switch.basement_track_lighting_switch is working normally. Does the light.basement_track_lights entity turn on and off without an issue?

No, the light.basement_track_lights is not available so it can not be turned on or off. That is the problem, the switch isn’t being converted to a light.
My understanding (which could be wrong of course) is that in the group you use the light. like I did in Basement Work Light, which works fine, meaning that the light identity doesn’t have to match the switch identity, just the switch name. Am I wrong in this understanding?

This is very strange…

Your understanding matches mine (if I follow you): the name Basement Track Lights will become basement_track_lights and thus you’d use light. basement_track_lights.

This wouldn’t explain the issue but at least as a test, use the switch entity in your group — you can mix these in a group.

I wonder if there could be anything special about the switch. What type is it and how is it set up? Anything else like an integration for the device or any other related config you can share?

Clasping at straws here…

Maybe also try readding/renaming only those switch and light entities and use single term names and IDs (I’m thinking foo, bar, bas, etc. like we programmers like to use for illustrative purposes).

Are you sure this entity id is 100% correct?

  - platform: switch
    name: Basement Track Lights
    entity_id: switch.basement_track_lighting_switch  ##### <------------

Have a go at recreating this light from scratch. Don’t use copy/paste. Try it in a different position in the light config.

What you have shown is correct. There is something funny going on here. A hidden non printable character or something like that.

Also have you checked your log for errors?

Well that seems to work okay. I can control all the lights and switch from the group. I took out the light group and switch to light definition and moved it all to my groups.yaml

  Basement Light Group:
    name: Basement Light Group
      - switch.basement_track_lighting_switch
      - light.basement_east_light_bulb
      - light.basement_west_light_bulb
      - light.basement_work_light

I would like to keep all my light groups together though in my lights.yaml and since I have the same scenario with my laundry group (which works just fine) I am stumped as to why the basement group isn’t working.

Tom, now that parautenbach’s suggestion worked in a group, I’m now going to type in everything from scratch in the lights.yaml just to make sure about hidden characters, etc. I have checked and rechecked the entity id and it is for sure correct, but let me do this and I’ll report back.

Don’t forget to check the log before restarting.

Same exact problem. I removed everything from groups.yaml, and typed in (no copy and paste) everything in a different position in lights.yaml and there is still no light.basement_track_lights. I checked the log prior to doing everything and the only error I can see is the same one I got when I retyped it all in and reloaded the group.
“2021-01-25 23:24:35 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.basement_track_lights” followed by:
“2021-01-25 23:24:36 WARNING (MainThread) [] Error reporting state - 5: Requested entity was not found.”
That’s it. prior to those errors it had “2021-01-25 23:23:50 INFO (MainThread) [homeassistant.components.light] Setting up” then the error.

Light groups go under the light: section, not the group: section. But I suspect you just miss typed this as you have the correct config location shown in your post above.

Go to your developer tools states menu and paste this into the “Filter Entities” section above the first column:


What shows up?

ok, let me first say, I renamed that switch entity to switch.basement_track, just to see if the entity name length would have any effect it does not. Still no light. So I just did what you asked and put switch.basement_track in developer tools and it shows the state as off and the state attributes as:
friendly_name: Basement Track Lighting

And this does not create a light after a restart?

light: # <--- somewhere above this OR light: !include <this file> in configuration.yaml
  - platform: switch
    name: Basement Track Lights
    entity_id: switch.basement_track

And there are no errors related to this light switch in your log?

If so, then I’m out of ideas.

Thanks for your help. I tried to delete and re-install the device, but that didn’t help. I then just tried creating a light from another switch I had (different brand) and that didn’t work either. In the end, the ability to change a switch to a light has completely disappeared from my system for some reason. An the logs have NO errors regarding any of the switches/lights that are in lights.yaml. The switch to light conversions that I had in there continue to work just fine, but I cannot create anymore switch to light definitions. So, I just need to figure out how it use to be done before. When you had a switch that you wanted to group with bulbs, how was it done?

Do you have your full config somewhere online to look at? Be sure to have removed sensitive details.

Just to make sure there was nothing wrong with the integration I created a new light switch:

- platform: switch
  name: Test light
  entity_id: switch.acrc

And it showed up in my system after a restart:

Screenshot_2021-01-27 Developer Tools - Home Assistant