New Raspberry Pi
A couple months back the Raspberry Pi foundation released their new iteration of the Raspberry Pi: The Raspberry Pi 4B. Along with the more powerful processor on board, they made a few huge changes that I am very excited about. The first big change was the USB and Ethernet now have their own dedicated controller, which allows Gigabit Ethernet as well as USB3 support. As well, for the first time, you can now buy 3 different models of the 4B, ones with either 1 GB, 2 GB or 4 GB of RAM. A few other smaller changes were done, such as having two micro-HDMI display outputs, each capable of 4K resolution and utilizing a USB type-C connector for the power delivery.
A couple weeks back, the 4 GB Pi that I ordered finally arrived. The kit I ordered (link) came with everything I needed to get started with the board: The Pi itself, a 2A power supply, a 32 GB SD card with N00bS installed, a Case, a couple of heatsinks and a micro-HDMI to HDMI cable. I installed the SD card into the Pi, then put the Pi into the case and connected the power supply, mico-HDMI and a keyboard an mouse to the Pi. Once the Pi finished booting up, I was prompted with an OS selection screen. I choose to use Raspbian as my OS, as its the simplest to use and supports all of the software I want to use.
What is Home Assistant?
The main use for my new Raspberry Pi is to run the open source software called Home Assistant. Home Assistant (link) is an open source software, written in python, that brings home automation to the user instead of in the cloud. The software has many integrations with commercially available smart home devices and ecosystems, such as Samsung Smart Thing and Philip Hue. The software supports many additional plugins and further expand its capabilities.
Installing Home Assistant
Home Assistant has many different methods of being installed depending on the system it’s being run from. The two most popular methods are either barebones or Hass.io. The Barebones method will only install the python program, which means an OS capable of running it must already be setup. The other method, Hass.io, is the all-in-one package that include the OS and all tools needed to run Home Assistant, and is the prefered method to run Home Assistant. Hass.io can be installed as the OS that the Pi runs, or it can be ran inside a Docker Container. The Docker Container method is the method I will be using since I would like to run more than just Home Assistant on my new Raspberry Pi.
Since the Raspberry Pi 4 came out fairly recently, there does not seem to be an official docker image of Hass.io, but the Raspberry Pi 3B+ image seems to works good enough. If you are installing this on another device, you can try and follow the instruction found here. First we need to prepare the Raspberry Pi 4 to run docker and then install the Hass.io image and run it. I won’t go over how to set up a Raspberry Pi to connect over Wi-Fi or how to set up SSH, there are plenty of tutorials online on how to do that already. Once the Pi has gone through its initial setup, we can open up a terminal, either locally or through SSH ( Which I use MobaXterm to connect). First ensure the system is up to date with the following commands:
sudo apt-get update sudo apt-get upgrade
Then we can install docker itself onto the Pi:
sudo curl -sL get.docker.com | sed 's/9)/10)/' | sh
Once Docker has finished being installed, we want to install any dependencies that docker may require:
sudo apt-get install apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat software-properties-common
Note: During any of the above commands, you may be required to acknowledge the install by typing “YES” or similar.
It might be a good time to restart the Pi at this point so everything can take effect.
Once the Pi comes back up, we can finally install the Hass.io docker image. As stated above, there is no official image for the Raspberry Pi 4, so we will have to modify a file to tell the system to use the Raspberry Pi 3 image instead. Make sure you are in the home folder for your user and run the following command:
sudo curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" >> hassio_install.sh
That should download a bash script, hassio_install.sh, and put it into your home directory. Open that file using either nano or if SSHing in, a text editor on the local machine. Around line 91 you should see “armv7l”. Replace:
"armv7l") if [ -z $MACHINE ]; then echo "[ERROR] Please set machine for $ARCH" exit 1 fi HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant" HASSIO_DOCKER="$DOCKER_REPO/armv7-hassio-supervisor" ;;
With the following:
"armv7l") HOMEASSISTANT_DOCKER="$DOCKER_REPO/raspberrypi3-homeassistant" HASSIO_DOCKER="$DOCKER_REPO/armhf-hassio-supervisor" ;;
This should tell the script to use the Raspberry Pi 3 image instead. Finally we want to run the script to install the docker image and setup system to auto-run at startup:
sudo bash hassio_install.sh
This might take a few minutes, but should give you feedback as it progresses.
Running Home Assistant for the First Time
Now that we have installed Hass.io in a docker container, everything should be setup and running at this point. In a web browser, go to “hassio.local:8123”. If everything is going well, you should either see a screen saying to wait or a login screen. If the browser does not find the site, you might need to find the IP address of the Pi and use that instead ( 192.168.1.XX:8123). Once the Login screen appears, you will need to create an admin account. Follow the instructions and make sure to use a strong password. As you go through the first time setup, it may prompt you to set up found devices. You can either do that at that point, or at a later point once you are more familiar with the system. If everything went well, you should be greeted with the home screen of home assistant.
This was just the initial set up of Home Assistant. In the coming weeks I plan on adding more functionality and adding some of my existing smart home devices so I can control them.