Step 11: Automation

So, you finally have all the building blocks for automation: a sensor to activate a switch or set of switches.

The original initial goal of this blog was to setup a cloud free home automation system, this got extended with the ability to control the lights a house without ever manually having to switch them on or off.

This is starting to be achievable! If you only have the one sensor then you will only be able to control one room, but the principles will be exactly the same.

There are example automation scripts that can do this, but lets build our own simple one. Please bear in mind that the setup described will only work with one actor i.e. one person within the home.

First you’ll need to start a new automation script via the big plus button within the automation configuration section.

Configuration -> Automations -> +

Give it a suitable name like “lounge lights” or whatever is appropriate, and set the motion sensor as a trigger event and then add a condition on the sensors luminance to ensure it is dark enough to warrant triggering the lights.

Then add all the light switches/devices that you want to turn off – such as all the ones outside of the room where the motion sensor for the trigger is – and then also add the lights switches/devices that you want to turn on as actions at the bottom of the automation screen.

Another option here is to call the scene.turn_on service and have a scene setup with the lights you want turning on. Unfortunately with this setup you do not want to simply create an all lights off scene and add that too as every-time motion is detected all the lights will turn off then the ones you want on will turn back on, so you want to set it as described to stop potential light flickering or make a collection of scenes – one for each room to control.

There are tons more automations capable and there will be a couple more covered in this stride, but first you will need to be able to access your system via the mobile app out and about for some real fun…

Next: Step 12: External

Step 10: Detail

To wrap up everything that helps enable automation you need to know about three more core functions within Home Assistant:

  • zones
  • areas
  • scenes

You have one zone setup from the beginning which is your Home zone, you can add other zones and areas directly through the Configuration panel.

Configurations -> Zones

Entering or leaving a zone can be used to trigger automations in your home. To take full advantage of this you need a device tracker linked to your user – this will be covered in the next stride.

Configuration -> Areas

Areas can be setup to group entities into an area or most likely a room. That way you can affect entities in a particular area. Devices will need to be configured to know what area it exists within.

Configuration -> Scenes

Finally scenes can put a set of entities into a particular pre-configured state, such as having a night mode scene that turns all lights out and disables motion detection in the bedrooms.

Complete: Stride 2: Lights, Camera, …