Fall 2020 update
In this first part of the Home Assistant Beginner’s Guide guide we’ll be going over the basics: A quick explainer on what Home Assistant and Home Assistant Core are, followed by the hardware requirements and installation of Home Assistant on top of the Home Assistant Operating System. This Home Assistant Beginner’s Guide was written using Home Assistant version 0.66.1 and updated using version 0.116.2. Major changes to the installation aren’t expected anytime soon.
Flying cars, robot butlers and automated homes. Sci-fi movies of years gone by predicted we’d have them all by now. My drone can’t fly down to the shops yet and although we have robot vacuums, they won’t be cooking our food anytime soon.
One prediction that is becoming a reality though is the automated home. You can tell your Google Home to play a series on your Chromecast enabled TV and your Philips Hue lights can automatically turn on when you get home from work. But what if I want my lights to turn automatically when I play said movie? Or what if I want to add lights from a different brand to my setup? Here’s where the current closed systems fail. To solve this problem, there are commercially available platforms you can buy or you could go down the tinkerer’s route and build your own. I went for the latter and built my own home automation platform using Home Assistant Core and Home Assistant!
Home Assistant is an open-source home automation platform and is still very much in the early stages of development, though every update is making it more beginner-friendly. As mentioned, it is very much a platform for tinkerers. Whilst some things can be configured using the UI, sooner or later you will be forced to dive into the code.
The importance of backing up
As always, it’s highly recommended to keep back-ups of everything you do. My naïvety led me to perform an update without backing up. My system just broke. There was nothing I could do except for a complete reinstall. I know, typical beginners error. But on the bright side, it did give me a chance to document what I’m doing and create this Home Assistant Beginner’s Guide.
Since first writing this beginner’s guide Home Assistant I’m happy to report that Home Assistant has become a lot more reliable and a lot more difficult to break. It is however still recommended that you regularly backup your system. For those interested, I’ve written an article on how to properly backup on my other website.
Home Assistant and Home Assistant Core in a Nutshell
To put things simply: Home Assistant Core is a Python program and can be run on various operating systems (and in a Docker container). Home Assistant (previously Hass.IO) is a fully UI managed ecosystem that runs Home Assistant Core, the Home Assistant Supervisor and Home Assistant add-ons. Home Assistant runs on top of the Home Assistant Operating System. Read this article for a more detailed description of the different Home Assistant names.
Home Assistant is best for beginners. The installation is done in a few steps that doesn’t require any technical knowledge and updates can be installed using the web-based UI. As part of your smart home Home Assistant will do the following:
- Observe the state of your smart-devices (e.g. check if the lights are on, get the temperature from a thermostat, see what’s playing on a Chromecast).
- Control all of your devices from a single interface (e.g. turn the lights on and off, set the temperature on a thermostat via the web based UI).
- Make your home adjust to what you’re with automation (e.g. turn on the lights when you get home, message you if you left something turned on when you leave the house).
Additionally Home Assistant is also perfect for everyone with privacy concerns. None of your data is stored in the cloud and you can keep your platform completely disconnected from the internet, if you choose to do so.
Getting Started with Home Assistant: Choosing the Hardware
Home Assistant is built to run on a Raspberry Pi, a cheap single-board computer. The Raspberry Pi 4 Model B is perfect for beginners. I recommend you go with the model with 4GB of memory as this will give you some headroom for add-ons. Whilst there are builds for older and cheaper models available, you’ll find them reaching their limits sooner rather than later. The Raspberry Pi can be bought from just about any electronics store and I highly recommend buying a set including a power supply and a case.
Next up, you’ll need a microSD card. A 32GB microSD is recommended and it’s the absolute minimum I’d go with. Make sure you don’t just go for the cheapest card. Application Class 2 is officially recommended for reliability’s sake. However, I recommend you go with an endurance microSD card. You can read why I recommend them in this article.
Of course, you’ll also need a way to read the card on your desktop PC or laptop. If you don’t want to buy the parts individually you’ll find several Raspberry Pi 4 Model B kits on Amazon.
Raspberry Pi 4
RAM: 1GB, 2GB, 4GB
CPU: Broadcom BCM2711
Requires a power supply and optionally a case.
Raspberry Pi 4 PSU
Power: 3 watts
Samsung PRO Endurance
Size: 16GB – 1TB
Features: Application Class 2
CanaKit Raspberry Pi 4 4GB Starter Kit
RAM: 1GB, 2GB, 4GB
Includes Raspberry Pi, case, heatsinks and fan, microSD card, and PSU.
While Home Assistant can be operated and accessed using a WiFi connection, I recommend connecting it to your router or switch using an ethernet cable. The connection will be more stable and faster (plus, the setup is easier).
With these three hardware requirements at your disposal, you’re ready to get Home Assistant installed!
Getting Started with Hass.io and Home Assistant: the Software
With the hardware ready you’re going to want to install balenaEtcher and an advanced text editor like Visual Studio Code (my recommendation). Next, download the latest Home Assistant image from here. Just make sure you select the image matching your Raspberry Pi model. Insert the microSD card into your computer and use balenaEtcher to flash the Home Assistant image to your card following these steps:
- Click on
Select imageand choose the
.img.bz2file you downloaded from the Home Assistant website.
- Make sure the correct microSD card is selected by clicking on ‘Change’ (if you only have one inserted into your computer, only one possibility should appear).
- Click on
Flashand wait for your image to be flashed on to the microSD card.
Installing Home Assistant
Once the image has been successfully burnt to the microSD card, simply eject the card, insert it into your (unconnected) Raspberry Pi and connect the ethernet and power cable. That’s it! Because Home Assistant is set up to be a headless system, there’s no need to connect a monitor or keyboard to your Raspberry Pi. Everything is controlled from a browser on another computer. Your Home Assistant will quietly be installed on the Raspberry Pi and should be ready in about half an hour.
To access you Home Assistant simply navigate to
HTTP://homeassistant.local:8123 in your browser of choice. Should that not work (a problem I’ve always experienced), you can use your router’s device list to look for an IP:
- If you do not know where your router is located: Press the ‘Windows’ and ‘R’ and open cmd. Type in the command ‘ipconfig’ and look for your
Default Gateway(usually 192.168.X.Y). That is your router’s IP address.
- Enter the router’s IP in your browser and log in. Search for a device list in the menu. You should see a device called
homeassistantsomewhere on that list. Copy the IP (192.168.X.Y) and paste it into your browser. Add
:8123(that’s the port) to the IP to access your Home Assistant. Your full address should be something like
Using the Home Assistant Configurator
Once you’ve gained access to your Home Assistant, you’ll be greeted by the UI that can be used to control your smart-devices. This interface will look very familiar to any Android users, as it follows the material design guidelines. You’ll also notice that a few devices will already have been added (such as Chromecast and Google Home devices) and the presence of the
As I’ve mentioned, there are some devices that can be set up using the UI. One example I have in my home are Philip Hue lights. Simply click on
Configure to get started. Should you have any difficulties during the setup you can search for each component on here to get a guided walkthrough.
With your devices added, you’ll be able to manually control the added devices from the UI. At this point, you might be thinking there’s no point to using Home Assistant over the devices own app (such as the Hue Android app). Don’t worry, in the upcoming guides, I’ll be showing you how to make the most of Home Assistant and why it’s so much more powerful than any other software!
Installing your first add-on
Before we dive in any deeper, you’re going to want to install a specific add-on: The Samba share. This add-on will allow you to access your Home Assistant configuration files from your PC.
- To get started select
Supervisorfrom the menu and select the add-on store.
- Look for the
Samba shareadd-on, click on it and hit
- Once the add-on is installed click on start. That’s it. Make sure you have
Start on bootenabled and I’d also recommend enabling
- To see your files press
Windows + Rand enter
\\YOUR-HOME-ASSISTANT-IP. By default, you’ll be greeted by the folders addons, backup, config and share.
Securing Your Home Assistant
It’s never a good idea to have unprotected devices in your network and doubly so if it’s a device controlling your home. Before we go any further, setting a password is essential. By doing this you’ll also get a first look at the code that powers your Home Assistant. To get started navigate to your Home Assistant share in Windows Explorer and enter the
config folder. Follow these steps to set a password:
configuration.yamlwith Visual Studio Code and look for
# api_password: !secret http_password. Let us dissect this line of code:
#means this line of code is a comment and will be ignored. By removing the
#and space (this is very important) this line will not be ignored anymore.
api_passwordis the setting we want to edit, i.e. password protecting your Home Assistant.
- Passwords shouldn’t be saved in this file. For added security, you can save the password in the
!secret http_passwordwill tell your Home Assistant to look for the password in the
secrets.yamlfile, under the description
- Now that we’ve uncommented (removed the
api_passwordwe can open the
secrets.yamlfile and set a password. Replace
welcomewith whatever you want your password do be.
- Save and close both files.
- Open the Home Assistant web UI. Click on
- I recommend you do this after each time you change any code: Click on
Check config. This will go through your files and make sure everything is in order with your code. If you receive any errors, go through the code again and only restart your Home Assistant once you get the
- Scroll down and restart your Home Assistant. Wait for the system to reboot and once you try to access it you should be presented with a password prompt.
Creating a Snapshot
Now that we’ve got things installed and running it’s high-time to create a first snapshot (backup) of the platform. To do this simply click on
Supervisor in the left hand menu, select
Snapshots and create a
So there you have it. You’ve successfully installed Home Assistant on your Raspberry Pi and have added the first add-on. The first part of the Home Assistant Beginner’s Guide is complete but we’ve only just scratched the surface. There’s so much more to Home Assistant to what we’ve just done and I’m excited to share all of my discoveries in the coming weeks and months.