Home Assistant: setup and install to automate your home

Home Automation

There are quite a few SmartHome hubs out there now such as Nest, SmartThings, HomeKit etc, but these are all owned by massive companies who make money from your data, so is your smart home actually private anymore? Did you know you could make your own Smart Hub that’s controlled by you, with no outside access? With a Raspberry Pi and the free Home Assistant software, you could be on the way to commanding your home in your own way and creating bespoke solutions just for you. 

Setting up Home Assistant

This helpful guide will give you all you really need to know, but let’s have a quick look at it anyway. You’ll need a Raspberry Pi 4 model B 4GB (or perhaps a NUC i3 if you want something a little beefier) for starters. An SD card reader, a quick 32 GB micro SD card application class 2 and some ethernet cable. 

Raspberry Pi 4 model B 2GB – Buy now

Next you’ll need to download the right image for your device so you can write it to the SD drive. Do this with some software called balenaEtcha . The best way to connect to your Raspberry Pi is to use a network cable, but if you’d prefer to use a connection over WiFi, or to give the Pi a static IP address then this can be done using a USB stick with the correct files on it. Instructions for this are in the getting started article.

Once the SD card is inserted, and the necessary cables have been plugged in, then the Raspberry Pi will boot up, connect to the Internet and immediately start to download the latest version of Home Assistant. While this is happening you can view the progress from another computer or your phone. Just navigate your browser to: http://homeassistant.local:8123. The process should take about 20 minutes to complete. By the way, the only way to access and administer the Home Assistant is via another computer.

Once the Home Assistant has finished installing, you need to create an account. This account will be the ‘Owner’ and it’s also the administrator account so you can make all the changes needed here. Entering your location will give the software some idea of when the sun goes up and down and what time zone you live in. Now the system will give you a list of devices it has detected on your network; you can add others later if you don’t see them just yet. You can set up each ‘Integration’ here or later on by going into Configuration from the menu. Click on each device and follow the steps necessary to add them into Home Assistant. From here you may now add each device to an Area, this just helps to organise things a bit.

Creating your first ‘Automation’

The next step after all the setting up etc, is to start automating things! Now in the ‘getting started’ guide they talk about automating the lights to turn on at sunset. To do this, navigate into the Configuration screen and click on Automations. Click the orange plus button at the bottom of the screen. You need to add a Trigger type of Sun. There are two events which can be clicked on; either Sunrise or Sunset. For this they click sunset and then they add an offset of -00:30:00. This means the lights come on half an hour before the sun sets. Which is great as this time varies everyday but you’ll always be able to see in the house.

Now we have a trigger you now need an Action. The action type needs to be set to ‘Call Service’, then you select the service ‘light.turn_on’. We’re going to turn on all the lights with this action so the service data entered is: entity_id : all. And that’s all you need to do. You have your first automation to test.

This might not be the most practical example so maybe a better one would be if you have a group of lights in the kitchen and a motion sensor you can pair these up in much the same way. Select your motion sensor in the Triggers section and then you would do the same Action as last time but enter light.kitchen in the entity_id: section. The next step would be to figure out how to make the lights turn off automatically after an allotted amount of time. There’s plenty more information about this over here so I’ll leave that up to you. Have fun!