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 Hass.io are, followed by the hardware requirements and installation of Home Assistant on top of Hass.io. This Home Assistant Beginner’s Guide was written using Home Assistant 0.66.1, although 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 tinkerers route and build your own. I went for the latter and built my own home automation platform using Home Assistant and Hass.io!
Home Assistant is an open-source home automation platform and is still very much in the early stages of development. 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. As always, it’s highly recommend 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.
Home Assistant and Hass.io in a Nutshell
To put things simply: Home Assistant is the platform and “Hass.io is an operating system that will take care of installing and updating Home Assistant“. Hass.io is the easiest way of installing and maintaining Home Assistant. The installation is done in a few steps that doesn’t require any technical knowledge and updates can be executed using the web based UI. As part of your smarthome 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 Hass.Io and Home Assistant: the Hardware
Hass.io is built to run on a Raspberry Pi, a cheap single-board computer. Whilst there are builds available for older and cheaper models, 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 is recommended but mine is working fine with just 16GB. Make sure you don’t just go for the cheapest card. Class 10 is recommended for reliabilities sake. Of course you’ll also need a way to read the card on your desktop PC or laptop.
While Hass.io 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 Hass.io and Home Assistant installed!
Getting Started with Hass.io and Home Assistant: the Software
With the hardware ready you’re going to want to install Etcher and an advanced text editor like Sublime Text (my recommendation). Next, download the latest Hass.io image from here. Just make sure you select the image matching your Raspberry Pi model. Insert the microSD card into your computer and use Etcher to burn the Hass.io image to your card following these steps:
- Click on ‘Select image’ and choose the .img.bz2 file you downloaded from github.
- 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 ‘Flash’ and wait for your image to be burnt on to the microSD card.
Installing Hass.io and 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://hassio.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 (192.168.X.Y). That is your router’s IP address.
- Enter the router’s IP in your browser and login. Search for a device list in the menu. You should see a device called hassio somewhere in the 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 192.168.X.Y:8123.
Using the 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 the Configurator. 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 Hass.io from the menu and go to the add-on story.
- Look for the Samba share add-on, click on it and hit Install.
- Once the add-on is installed click on start. That’s it. Make sure you have Start on boot enabled and I’d also recommend enableing Auto update.
- To see your files press Windows + R and enter ‘\\hassio’. 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 in Windows Explorer (\\hassio) and enter the config folder. Follow these steps to set a password:
- Open configuration.yaml with Sublime Text and look for # api_password: !secret http_password. Let us dissect this line of code:
- The # 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.
- The api_password is 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 password in the secrets.yaml file. !secret http_password will tell your Home Assistant to look for the password in the secrets.yaml file, under the description http_password.
- Now that we’ve uncommented (removed the #) the api_password we can open the secrets.yaml file and set a password. Replace welcome with whatever you want your password do be.
- Save and close both files.
- Open the Home Assistant web UI. Click on Configuration.
- 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 Configuration valid! Message!
- 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 Hass.io in the left hand menu, select Snapshots and create a Full snapshot.
So there you have it. You’ve successfully installed Hass.io and Home Assistant on your Raspberry Pi and have added a 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.