Using Groups in Home Assistant - Home Assistant Tips

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this home assistant tips video i'm going to show you how you can simplify your automations by using groups in home assistant groups are used to combine several entities of the same type together into a single entity for example if you have a bunch of smart lights in your hallway ceiling you can either use home assistant to turn them on or off one by one or you can add them to a group and turn them off with a single click you can do this with lights switches people curtains locks and many other entity types to get groups to work you'll need to do some editing of your home assistant configuration files but hopefully this will be possible from the user interface soon let's take a look at how i set up and use three different types of groups in my home assistant to simplify automations hey home automation guide start the show before i show you how i use groups in my automations let's take a closer look at how they actually work hopefully you're familiar with the different states that entities can have a personal device tracker entity can have a state of either home or not home a light can either be on or off with different attributes for the brightness level and color a lock can be locked or unlocked and a door can be either open or closed now imagine you have a bunch of different motion sensor entities and you want to get notified if any of them detect motion when you're away from home you could create an automation and add each individual device to the trigger that is definitely an option and would work perfectly fine or you could add all these motion sensor entities to a single group called all motion sensors the group will inherit the state of the entity that is non-standard for example if you have three motion sensors in your group and one of them detects motion then the whole group is set to that detected state if you have a group of smart locks and any of the locks is unlocked then the whole group will be set to unlocked if you have a group of people or device trackers and one of those people is home then the whole group is set to home if you have a group of lights and any of these lights is switched on you guessed it the whole group is switched on these groups may seem unnecessary at first but let's look at how you can create and use a group which will make it easier to understand why they're really useful to create a group you'll need to modify a configuration file you'll hopefully already have the file editor plugin installed in home assistant and then you can navigate to the groups.yaml file first we're going to create that group called all motion sensors give it a key in this case all motion sensors with underscores and then add a name property which will give it a human readable name now we can add the entity ids of all our individual motion sensors one by one click the save button and now we need to reload these groups into home assistant so that i can see them to do this go to configuration and then to server controls i would suggest that you now check your configuration to make sure you've not made any typos you should do this after every configuration file change that you make if everything looks good you can either restart home assistant or you can just reload the groups file which will be much faster if you now go to the developer tools you should see that group you created and the state that it's in if we switch back to the original automation that we were creating to notify us if motion was detected in the house when we're away we can replace all of these individual motion sensor entities with one group like this so let's imagine we now go out and buy two new motion sensors to put in the garage we want to incorporate them into this automation we can simply load up that groups.yaml file and add the entity ids of my new motion sensors to the entity list of that group once we reload the groups any automation or script that uses that group will be immediately updated to include those new motion sensors you don't need to remember which automations made use of the motion sensors you don't need to go and update them one by one going back to our automation that notifies me if motion was detected in the house we need to add a condition to only send this notification if none of the people who live there are home we could once again add a condition for every person who lives here to check if they're home or not or we could add all the people who usually live in the house to a new group called residence this is done in the same way as the motion sensor group give it a key a human readable name and a list of the entity ids of all the person entities that you have in home assistant re-import the groups and you'll have a new residence group entity available i have a ton of automations that either get triggered when we leave the house or come home as well as other automations that check to make sure that someone is home before they run the advantage of using a group for this is that i can easily add a new resident if a friend or my parents come over and stay with us and i can modify existing residents if they get a new phone or device tracker with a new name i only have to modify this one residence group in a single place and all these automations get updated i've actually written a blog post all about presence detection in home assistant and how i use multiple different tests to accurately determine if someone is home or away i've linked to this blog post in the description below and i highly recommend that you check it out the final type of group that i use in my house is a light group which you guessed it is a group of lights i have some smart lights that i never really control individually only ever in groups and it's super annoying to individually turn on and off these lights for example i have two ceiling lights in my hallway which i've grouped together like this and i use my office lights group to quickly turn on or off all the lights in this room some people might use areas in home assistant to achieve similar results but this doesn't always work for example i have an area called kitchen but three different light groups one for the ceiling lights one for the floor lights and one for the cabinet lights i rarely want to turn all of these lights on at once and i never want to turn on these lights individually i use different combinations of these groups to achieve different mood lighting depending on what i'm doing unlike the two other groups that i've spoken about in this video light groups are a different type of group entirely before you ask i have no idea why i'm sure there's some sensible reason for it but i don't know what it is like groups are also configured in a configuration file but in the standard configuration.yaml file rather than the groups.yaml file the concept is similar though go to your file editor and edit the configuration.yaml file if you have an existing key in this file for lights you can append the group configuration there if you don't then just create a new light key then create an entity for the platform and tell it that it's a group now give it a human readable name just like before and add the entity ids of all the lights you want to add to this group save the configuration file go to the server controls area of home assistant and check your configuration if everything looks good you'll need to restart home assistant you can't do a sneaky reload for light groups once home assistant has restarted you'll be able to use this new light group just like any normal light when you make changes to the light group like setting the brightness or color it will apply those attributes to all the lights in that group once again this is really handy because you can use this light group in your automations and scripts i use groups in so many areas of home assistant that i couldn't imagine being without them if you want to see more ways that i use groups to simplify my automations check out my lighting door sensor and motion sensor automation videos if you found this video useful please give it a thumbs up to let me know i regularly release videos about home automations so if this is your jam then click the subscribe button so that together we can make your home smarter
Info
Channel: Home Automation Guy
Views: 13,604
Rating: undefined out of 5
Keywords:
Id: 8G_nzC-T914
Channel Id: undefined
Length: 7min 33sec (453 seconds)
Published: Wed Nov 17 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.