How to establish a cluster of lights in Home Assistant
In this tutorial, we will be forming a cluster of lights in Home Assistant that can be managed either through a button or within an automation. The benefit of this approach is the ability to regulate multiple lights collectively, rather than individually controlling each light in an automation or script.
Identifying all entities to include in the cluster
Initially, we need to jot down the entities of the lights we wish to group. You can locate them under the development tools by navigating to development tools, then states, and entering "light." In the image below, I've indicated where you can find the entity names.
Locating entities in Home Assistant
To achieve this, we must modify the configuration.yaml file in Home Assistant. You can accomplish this via an FTP or smb connection, but it's simpler to install a plugin called file editor and edit the file in the GUI. To install this plugin, go to Supervisor -> Add-on Store, and select File editor to install the add-on.
Installing file editor in Home Assistant
Once the add-on is installed, you will find it in the menu. Click on the file editor button.
Then, click on the folder in the upper right corner.
Now, click on configuration.yaml.
Editing configuration.yaml within Home Assistant
Scroll all the way down and add the following code with the entities you noted earlier, changing the name to your preference. Pay attention to the spaces, as it is YAML code.
light:
- platform: group
name: Fitness Lights
entities:
- light.spot_light_1
- light.spot_light_2
- light.spot_light_3
- light.spot_light_4
- light.spot_light_5
- light.spot_light_6
Once completed, click on the Save button.
Verifying the configuration in Home Assistant
Before the light group appears in Home Assistant, we need to reboot it. However, first, we should check if the entered code is valid.
- Click on Configuration.
- Click on Server Controls.
- Click the "Check configuration" button.
Check configuration in Home Assistant
If the configuration is valid, you can restart Home Assistant by clicking on "Restart" on the same screen.
Restart Home Assistant
If it's not valid, go back and edit the file again, focusing on correcting any spacing errors.
Identifying spaces in configuration.yaml
Locating the light group in Home Assistant
You can find it under the development tools by typing "light" again and searching for the name you assigned. Take note of the icon it carries. Now, you can utilize this entity in automations or scripts or place it under a button on your dashboard.