I have been a fan of Home Assistant for some time now and have set things up a few times in the past but have always changed away from it for one reason or another. Home Assistant has tons of integrations and you can do things with it that commercially available home automation platforms like Wink and SmartThings really can only dream of. The more I think about Home Assistant to less reasons I have not to run it but the one thing that has always been a non-starter for me has been that I needed to dedicate a Raspberry Pi to it. Recently I have been spending a good amount of time playing around with Docker on one of my Raspberry Pi setups and happen to find a way to run Home Assistant inside of a Docker container on a Raspberry Pi running Raspbian.
When I first started looking into running Home Assistant inside of a Docker container I stumbled upon some instructions on the Home Assistant website which I quickly jumped head first into and ran the commands listed for a Linux system, since Raspbian was Linux based I blindly though that these instructions would work. Well they didn’t the documentation on running Home Assistant in a Docker container on the Home Assistant website does not apply to the Raspberry Pi (or any ARM based system). I struggled for a good hour plus trying to troubleshoot what was going on when all along I was trying to run a Docker Image that was not compatible with my Raspberry Pi. Now I am sure someone with a bit more knowledge than me would have figured this out sooner or even known that it would not work before trying to set things up but I did not see anything that said specifically that the image did not support ARM based systems and it was not until I spent a good amount of time on the Home Assistant Discord Chat Server that I was pointed in the direction of the Raspberry Pi 3 Home Assistant Repository on the Docker Hub. This is exactly what I needed and from there I was able to quickly get things up and running.
With the mistakes out of the way you can install Home Assistant on a Raspberry Pi inside of a Docker container in just a few simple steps. Follow along below if you are interested in getting this setup for yourself:
First what will you need?
- Raspberry Pi 3+B (nice to start with a kit as they will typically include a case and power supply)
- MicroSD Memory Card
- Micro USB Power Supply
- Raspberry Pi Case
To begin the installation process you will need a MicroSD Memory Card, and the ability to format and burn an image to that MicroSD Memory Card. I am sure most of you know how to do these steps already, but I will give my recommendations, for formatting I prefer to use SD Memory Card Formatter for Windows and to burn the image Etcher.
Memory Card Preparation:
- Insert MicroSD Memory Card into a computer
- Open SD Memory Card Formatter for Windows
- In SD Memory Card Formatter for Windows Select the Drive that corresponds to your Memory Card
- In SD Memory Card Formatter for Windows Click Format and wait for it to finish
- Download the Raspbian disk image from https://www.raspberrypi.org/downloads/raspbian/
- Open Etcher.
- In Etcher Select the previously Downloaded Image
- In Etcher Select the Drive that corresponds to your Memory Card
- In Etcher Click Flash and wait for Etcher to Finish
Raspberry Pi Setup:
- From the Raspbian Desktop launch Terminal
- From Terminal you need to install Docker using the follow command,
- curl -sSL https://get.docker.com | sh
- From Terminal reboot your Raspberry Pi using,
- sudo reboot
- From the Raspbian Desktop launch Terminal
- Visit the Raspberry Pi 3 Home Assistant Repository on the Docker Hub to determine the latest version available
- From Terminal run the following commands to download and run Docker Image,
- sudo docker run -d –name=”home-assistant” –net=host -v /home/pi/home_assistant:/config -v /etc/localtime:/etc/localtime:ro –restart unless-stopped homeassistant/raspberrypi3-homeassistant:[insert latest version number]
That’s it that’s really all it takes to get Home Assistant up and Running inside of a Docker container on your Raspberry Pi 3. You can now access Home Assistant using a web browser from a device connected to the same network by navigating to http://ipaddressofpi:8123
Anyone running Home Assistant? Let me know your thoughts in the comments below.
I am passionate about the IoT and connected devices. Using connectivity to automate our lives will empower civilization to achieve greatness.