Installing Home Assistant on the Raspberry Pi

The official Home Assistant blog post outlined four installation methods. Only one of these methods supports add-on component, while allowing me to retaining full control of the operating system on the Raspberry Pi. This was called Hass.io for generic Unix, and is now known as Home Assistant Supervised. Here is the procedure I used to setup my Raspberry Pi 3B+ as a dedicated home automation hub running Raspberry Pi OS Lite:

  • Download and install Raspberry Pi OS (32-bit) Lite from https://www.raspberrypi.org/downloads/raspberry-pi-os/. Use Etcher to flash the downloaded image onto a SD card.
  • Since the Raspberry Pi is going to be a dedicated hub, I set it up to run in headless unattended mode. For this, a couple of files need to be created on the root partition of the SD card:
    • create a blank file called “.ssh” in the /boot directory to enable SSH
    • enable wifi by creating a file named “wpa_supplicant.conf” with the following content:
       country=us
       update_config=1
       network={
         scan_ssid=1
         ssid="MySSID"
         psk="MyPassword"
       }
  • Install prerequisite software:
sudo -i 
apt-get update
apt-get install -y software-properties-common apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat
systemctl disable ModemManager
systemctl stop ModemManager
  • Install Docker:
curl -sSL https://get.docker.com | sh
  • Install Home Assistant Supervised (hass.io):
curl -sL "https://raw.githubusercontent.com/Kanga-Who/home-assistant/master/supervised-installer.sh" | bash -s -- -m raspberrypi3
  • This will install hassio-supervisor and homeassistant as docker containers. The install process will take 20 to 30 mins. While the install script is running, you check the progress at http://raspberry-pi-IP-address:8123:undefined
  • Once the install is complete, the screen above will be replaced by Home Assistant login screen. Proceed with account creation by entering a new user name and password.
  • The devices that are controlled by the Raspberry Pi will need to know its IP address. For that purpose, it will be easier to assigned it with a fixed IP address. This can be done either from the router DHCP, or adding the following lines to the Raspberry Pi’s /etc/dhcpcd.conf:
# eth0 is wired LAN
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

# wlan0 is Wifi
interface wlan0
static ip_address=192.168.0.200/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
  • Finally, don’t forget to change the default password of your Raspberry Pi!

Notes on SD card: The first SD card I used was a 8GB class 10 type. After installing Raspberry Pi OS and Home Assistant it has about 1GB left. Although this is enough for my home automation setup, I switched to a 64GB UHS-I V30 card to see if there is any notable differences in performance, and it did. I didn’t run and formal benchmark, but from my overall experience, Home Assistant runs around 20% to 30% faster, and IO intensive tasks like apt-get was even faster. I was happy with the performance improvement and kept the 64GB card.

2 thoughts on “Installing Home Assistant on the Raspberry Pi

Leave a comment