How to group sonoff switches by room

If you added that to groups.yaml, then why did you specify light: domain in it? That’s invalid.

Do you want to create a Group or a Light Group? (They’re two different concepts)

A light group because I want to group various lights together. For example I want to group all living room lights into a Living Room Group. Then I also want to go further and create groups of groups of lights because I will have all Garage Lights Group + Front Door Lights Group + Patio Lights Group = External Lights Group.

Then you shouldn’t be adding it to groups.yaml because that’s for the Group integration. Follow the instructions for the Light Group integration.

However, you should know that Light Group is for grouping lights whereas you are using switches

Perhaps a traditional Group is all you really need here.

Got it! Thanks. Can I still give it a cool icon though? :slight_smile:

Ok I got rid of the stuff in the configuration.yaml and went to the groups.yaml and added this:

group:
  room_lights:
    name: Studio
    entities:
        - switch.sonoff_1000a83860_1
        - switch.sonoff_1000a83860_2
        - switch.sonoff_1000a83860_3
  danny_lights:
    name: Dannys Outside Relay
    entities: 
        - switch.sonoff_100064b24a
  Master_Bedroom:
    name: Master Bedroom
    entities:
        - switch.sonoff_100064b2ee
  Laundry:
    name: Laundry
    entities:
        - switch.sonoff_100064ca09

The file saves properly but I get this server configuration invalid error:

Invalid config for [group]: [room_lights] is an invalid option for [group]. Check: group->group->group->room_lights. (See /config/configuration.yaml, line 138).

Remove the first line:

group:

because that’s not needed within groups.yaml.

Thanks it works now…sorta:

As you can see its bulky and doesnt fit on one screen. Im going to try and have this on an ipad so it needs to be more compact.

That is why I asked if I could group groups, so for example:

  1. I have lights and wall sockets mixed together. First grouping would be all light switches in Group 1 and all sockets in Group 2. If I can do that Im sure I could handle the rest of the grouping…

thx in advance…

It works precisely the way it has always worked. Each group is displayed in the automatically generated Lovelace view, including nested groups, in whatever order Home Assistant chooses.

If you want to control the order of how any card (not just Entities Cards displaying groups) appears in a view, you must create a new view and arrange the cards the way you want.

Ok could you point me in the right direction because I want to nest groups.

I dont wish to control the order, just the grouping of entities inside. For example in the picture there are Den Sockets and Patio Sockets and I would like to have 1 card show up called SOCKETS and when you click on it, it takes you to a screen where you can see the individual cards inside; Den Sockets and Patio Sockets.

oh i just made a mess editing my lovelace, i think…

You do that by creating a group containing other groups.

There’s no standard Lovelace card that behaves like that. Even if there was, the automatically generated Lovelace dashboard isn’t configurable.

You will have to look for a custom card that approximates the behavior you want (assuming one exists). However, the use of a custom card means you will have to define your own Lovelace dashboard and arrange the cards the way you want.

NOTE
The original question has been answered and all syntax errors have been corrected. Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. It helps users find answers to similar questions concerning the creation of groups.

ok i found a video to customize lovelace ui to your liking. I clicked on the gear wheel top right and selected TAKE CONTROL. How do I get rid of that and go back to my default config?

Create a new dashboard and allow Home Assistant to populate it with all your entities (this will become a new automatically generated dashboard).

Yes but when I go into my HA, i get a blank screen now, presumably because i told HA i wanted to “take control” of my dashboard. But I dont want to anymore, how do i get my old dashboard back?

GOT IT! Ok so im back to grouping groups…

The way I explained above, by creating a new one allowing it to be populated.

You can’t undo what you just did and Home Assistant informed you of it just before you confirmed you wanted to take control of the default dashboard:

This dashboard is currently being maintained by Home Assistant. It is automatically updated when new entities or Lovelace UI components become available. If you take control, this dashboard will no longer be automatically updated. You can always create a new dashboard in configuration to play around with.

Are you sure you want to take control of your user interface?

ok so for nesting groups, do i just do this in order to put Patio Group & Garage Group into the main OUTSIDE Group:

Outside:
  Patio:
    name: Patio Sockets
    entities:
        - switch.sonoff_10008c0dab
        - switch.sonoff_1000aa7e4c
  Garage:
    name: Garage
    entities:
        - switch.sonoff_1000650c18_1
        - switch.sonoff_1000650c18_2
        - switch.sonoff_1000650c18_3

Guess not cause i get this config error:

Invalid config for [group]: [Patio] is an invalid option for [group]. Check: group->group->Outside->Patio. (See /config/configuration.yaml, line 139).

Like this:

  patio:
    name: Patio Sockets
    entities:
      - switch.sonoff_10008c0dab
      - switch.sonoff_1000aa7e4c
  garage:
    name: Garage
    entities:
      - switch.sonoff_1000650c18_1
      - switch.sonoff_1000650c18_2
      - switch.sonoff_1000650c18_3
  outside:
    name: Outside
    entities:
      - group.patio
      - group.garage

Thanks. I followed your format like this, but it didnt create the groups:

Entrance:
  name: Entrance
  entities:
      - switch.sonoff_10007ee316_1
      - switch.sonoff_10007ee316_2
den_room:
  name: Studio
#  icon: mdi:motion-sensor
  entities:
      - switch.sonoff_1000a83860_1
      - switch.sonoff_1000a83860_2
      - switch.sonoff_1000a83860_3
Old_Den_Extra:
  name: Old Den Extra Lamp
  entities:
      - switch.sonoff_1000b84968
Den_Sox:
  name: Den Sockets
  entities:
      - switch.sonoff_1000cf9964
      - switch.sonoff_1000cf9c6a
THE_DEN:
    name: The Den
    entities:
        - group.den_room
        - group.Old_Den_Extra
        - group.Den_Sox
Master_Bedroom:
  name: Master Bedroom
  entities:
      - switch.sonoff_100064b2ee
Master_Sox:
  name: Master Bedroom East Socket
  entities:
      - switch.sonoff_1000cf9c0f
MASTER:
    name: Master Bedroom
    entities:
        - group.Master_Bedroom
        - group.Master_Sox
Sams_Terrace:
  name: Sams Terrace Lights
  entities:
      - switch.sonoff_10007ebeee_1
      - switch.sonoff_10007ebeee_2
      - switch.sonoff_10007ebeee_3
Sams_Sox:
  name: Sams East Socket
  entities:
      - switch.sonoff_1000cf9a8b
SAM:
    name: Sams Bedroom
    entities:
        - group.Sams_Terrace
        - group.Sams_Sox
don_relay:
  name: Don Outside Relay
  entities: 
      - switch.sonoff_100064b24a
Don_Lights:
  name: Don Lights
  entities:
      - switch.sonoff_10007ece5a_1
      - switch.sonoff_10007ece5a_2
      - switch.sonoff_10007ece5a_3
DON:
    name: Dons Bedroom
    entities:
        - group.don_relay
        - group.Don_Lights
Laundry:
  name: Laundry
  entities:
      - switch.sonoff_100064ca09
Stairs:
  name: Stair Lights
  entities:
      - switch.sonoff_100064ccb7_1
      - switch.sonoff_100064ccb7_2
Guest:
  name: Guest Bathroom
  entities:
      - switch.sonoff_100064e8be_1
      - switch.sonoff_100064e8be_2
Linen:
  name: Linen Relay
  entities:
      - switch.sonoff_10007ec067_1
      - switch.sonoff_10007ec067_2
      - switch.sonoff_10007ec067_3
SERVICE:
    name: Service
    entities:
      - group.Laundry
      - group.Stairs
      - group.Guest
      - group.Linen
LR1:
  name: Living Room1
  entities:
      - switch.sonoff_10007ee105_1
      - switch.sonoff_10007ee105_2
LR1_Sox:
  name: Livingroom1 Socket
  entities:
      - switch.sonoff_1000cf9fbb
LR2:
  name: Living Room2
  entities:
      - switch.sonoff_10007ecf09_1
      - switch.sonoff_10007ecf09_2
      - switch.sonoff_10007ecf09_3
LR2_Sox:
  name: Living Room2 Socket
  entities:
      - switch.sonoff_1000cf996a
#        - switch.sonoff_1000cf9994 UNKNOWN
LIVING:
    name: Living
    entities:
      - group.LR1
      - group.LR1_Sox
      - group.LR2
      - group.LR2_Sox
Patio:
  name: Patio Sockets
  entities:
    - switch.sonoff_10008c0dab
    - switch.sonoff_1000aa7e4c
Garage:
    name: Garage
    entities:
        - switch.sonoff_1000650c18_1
        - switch.sonoff_1000650c18_2
        - switch.sonoff_1000650c18_3
OUTSIDE:
    name: Outside
    entities:
      - group.patio
      - group.garage
Kitchen_Sox:
  name: Kitchen West Socket
  entities:
      - switch.sonoff_1000cf9c2e
Pantry:
  name: Pantry
  entities:
      - switch.sonoff_10007d355e_1
      - switch.sonoff_10007d355e_2
Dining:
  name: Dining Room Socket
  entities:
      - switch.sonoff_1000cf982b
DINING:
  name: Dining
  entities:
    - group.Kitchen_Sox
    - group.Pantry
    - group.Dining

Respectfully, how much of the documentation have you read? I’m asking because the mistakes you are making suggest you have not reviewed the basics of Home Assistant. I recommend, at an absolute bare minimum, to read this section if you intend to modify anything in YAML:

The reason why it refused to create the groups is because there are several basic YAML syntax errors. After it failed to produce the groups, did you check Configuration > Logs? It undoubtedly contains error messages.

  • Don’t capitalize key names (like OUTSIDE and DINING and Kitchen_Sox).
  • Don’t duplicate key names (for Home Assistant there’s no difference between Dining and DINING).
  • Be consistent with indentation (sometimes you use 2 spaces, sometimes 4).
  • An entity_id is always in lowercase (never uppercase or titlecase like this group.Old_Den_Extra).

After you fix all of the YAML mistakes, execute Configuration > Server Controls > Reload Groups and then check Logs to ensure no new errors are reported.

Screenshot from 2021-09-12 19-56-05