After getting Home Assistant running and hooked up with some device, it is time to start putting automation into the system. For example, I have 10 different light bulbs in my system and I would like to make some automated control over them. Follow along and you may learn how to master yours!
Before starting the actual automating I want to make some minor adjustments because I noticed all my light bulbs are in one messy bundle in Home Assistant GUI. I would like to have them neatly arranged to indoor and outdoor lights. The groups are there to rescue. Open up groups.yaml -file, which can be found from the same config -folder. Here you can easily group yours entities, for example like this:
In case you wonder how to know the exact names of the entities, you can find a complete listing of available entities and their attributes by following the second link States located under the Developer Tools menu.
After saving the groups -file and restarting Home Assistant, you should be able to see the difference:
Now, similarly the actual automation code can be added to a separate file. Look at the automations.yaml. To automate outdoor lighting according to the status of sun I append the there the following:
Look at the code. I think you can easily find out what happens there. Note that I have some extra definitions for some light bulbs because I am able to adjust not only their brightness but also color tune. You can find all the possible attributes from the very same page we already looked at for the entity names. Also, you can use the group names as I did for the latter automation.
I case you are not happy with the timing set exactly to the moment of the sunset event, you have many possibilities to tweak the setup. I give below couple of ideas to try out as alternative triggers:
Hope you got everything running smoothly. In case you face problems, let me know by adding a comment and I will try to help you further. Also, please comment if you have any other feedback.