Home Assistant

Automate your home using Open Source projects.



For this project we are going to be using an Open Source project called Home Assistant, there is a Docker install, pi install, and hardware you can buy from them as options. The project is open source and privacy forward, so by default everything is done locally so you can control your own data.

Rating

Skills and assumed supplies

NOTE: Need a refresh? Check out my YouTube playlist on how to use the Command Prompt

Supplies and costs

Home Assistant

Home Assistant is an open source project where you can integrate lots of devices and information into one place so you can see a ton of information about your home. A great example is their Demo of a fully featured home assistant setup showing things like energy distribution of a home, cameras, lighting, and even have integrated music. One of the things that makes this project so interesting is that anyone can develop for it! So there is a huge library of things we can add, devices we can work with, and even have the option to create our own things if we want to.

The way home assistant functions is to have a dashboard that is the base, then we can add things to it as we want them. So for example, if we wanted to track our energy usage in our home, we can use one of the energy integrations on the base configuration. The base configuration is what we'll be setting up here, and then I'll have some suggested easy integrations in the "Suggested Upgrades" section at the bottom of this page. And some guides on some of the more involved upgrades such as adding in a floor plan with control for lights, cameras and fans.

Unsure what to pick? If you already have a Raspberry Pi try that one! It's the preferred method in their documentation, and this runs great on a Pi. Already have a home server? Do it on there because you don't need to buy anything new and if you love the project you can always move to a Pi later.

How to set up Home Assistant using Docker

First we need to login to our server. Then we can run the given Docker command from the documentation You'll need to scroll down to the portion that is for container installs.

docker run -d 
                    --name homeassistant 
                    --privileged 
                    --restart=unless-stopped 
                    -e TZ='America/New_York'
                    -v /PATH_TO_YOUR_CONFIG:/config 
                    --network=host 
                    ghcr.io/home-assistant/home-assistant:stable

NOTE: You should change PATH portion of the config so that it matches your server, for example "/home/user/Homeassistant:/config", you should also change your time zone if you are not on the East Coast of the US.

Now one thing to note, you'll see \ on the lines in the documentation, you don't type those in, those are there to indicate that the command continues even though it's on a new line. One way to handle this is to copy/paste the command into a text file, make your edits, and then copy/paste into your terminal. That way you don't have to risk typos, or deal with scrolling through a long command on the terminal.

How to set up Home Assistant using Kubernetes

If you haven't already set up your namespace, I recommend you do that first. I have a sample recipe for that here that will create a namespace called smart-home, you can reference how to use kubectl if you want to refresh on how to set that up. Check to make sure your namespace is up by doing
get namespaces

Next we need to setup our YAML file for Home Assistant, a sample is here, you can use this but you MUST change the location of your storage. I have a comment in there on where to change the YAML, and some notes about how the YAML is put together, but you have to make sure you have a path to where you want your information stored. If you update nothing else in that file, you still HAVE to update the path in BOTH places on the persistent volume areas.

If you need a reminder on how to use kubectl please go check out my kubectl guide here and make sure to run in the correct directory

Now you're set up to start trying out Home Assistant. NOTE: you'll be accessing your Home Assistant through a web browser, this browser needs to be on the same network as your server because we're using local addresses.

How to set up Home Assistant using a Raspberry Pi

There is actually a great guide for installing on a Raspberry Pi right in their documentation. You'll need a Pi, power supply, SD card and an ethernet cable. The documentation will take you through how to put the Operating System on the SD card, and then you can start up your Pi and get going. You will need to know how to see the IP address of your Pi, this can be done in several ways, option 1 is logging into your router and checking the address of the Pi, option 2 is logging into the Pi and running
hostname -I
You're likely to see the address as either
192.168.X.X
or
10.10.X.X

No install, just buy

One option you can do if none of the above are appealing to you, is buy their hardware with home assistant pre-installed. You do not have to, but you can if you wish. It is still the open source version of home assistant, so nothing is changing in the code, it's just a way to get setup very quickly by spending money instead of time. As of October 2022 they are doing pre-order for home assistant Yellow and there are three options; standard, kit with power supply, and Kit using Power over Ethernet (PoE). NOTE: This kit is basically a Raspberry Pi with some fun additions like ZigBee, PoE and a nice case. This is still Open Source, it's still using Home Assistant, and it's still community driven, what you're paying for is the convenience of having it come to you already set up and basically ready to go.

How to use Home Assistant

First we need to open up the dashboard. You'll need to go to the IP address of your Raspberry Pi, or container in your web browser.
http://IPaddress:8123

image of empty homeassistant first login

and then we can pick our username and password

image of  homeassistant creating username

Now, lucky for us the documentation for the setup process is actually pretty good! So we can go to Onboarding, and then follow the steps to get our home assistant located on the map

image of  homeassistant getting location

see if there is anything it can detect as devices it can talk to in your home, and then we are greeted with a dashboard.

image of  homeassistant empty dashboard

Congratulations! You are now ready to automate your home as you like! This is a vibrant community of people and possibilities. You could get started by doing some home automation like turning lights on at sunset or maybe you would like to add a camera, there are a huge number of examples to choose from, and there is a a forum with even more choices. Have fun!