Raspberry Pi Home Assistant Install and Setup
Raspberry Pi Home Assistant Overview
Make sure if you don’t have your Raspberry Pi setup with SSH enabled, and running on the proper power supply. Check out our Raspberry Pi Installation if not.
We are going to install on a virtual environment, which will have minimal
overhead. Firstly, you’ll need Python 3.5.3 or later installed, which is fine if
you have Raspbian Stretch.
Raspberry Pi Home Assistant Setup
$ ssh <firstname.lastname@example.org>
$ sudo apt-get update
$ sudo apt-get upgrade -y
Raspberry Pi Installation of Dependencies
$ sudo apt-get install python3 python3-venv python3-pip
Now we will add an account for Home Assistant called
homeassistant. This will
only be used for running Home Assistant so we will use the extra arugments of
-rm to create a system account and home directory.
-G dialout,gpio, adds the
dialout and the
gpio group. Zigbee and Z-Wave controllers need
dialout, and gpio is used for the GPIO Pins on the Raspberry Pi.
$ sudo useradd -rm homeassistant -G dialout,gpio
Now we will create a directory on the Raspberry Pi to install Home Assistant
into. Also we need to change the owner to
$ cd /srv $ sudo mkdir homeassistant $ sudo chown homeassistant:homeassistant homeassistant
Now we need to create and change to our virtual enviornment for Home Assistant.
This will need to be done in our
$ sudo -u homeassistant -H -s $ cd /srv/homeassistant $ python3 -m venv . $ source bin/activate
After you have activated your
homeassistant virtual enviornment, we will need
to run a command to install a required python package.
(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ python3 -m pip install wheel
Once you have installed the required python package it is now time to install
(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ pip3 install homeassistant
Now to our final step to Start Home Assistant for the first time. This will
complete the installation, create the .homeassistant configuration directory in
the /home/homeassistant directory and install any basic dependencies.
(homeassistant) $ hass
You can now reach your installation on your Raspberry Pi over the web interface
You can find your ip address using this command
When you run the hass command for the first time, it will download, install
and cache the necessary libraries/dependencies. This procedure may take
anywhere between 5 to 10 minutes. During that time, you may get “site cannot
be reached” error when accessing the web interface. This will only happen
for the first time, and subsequent restarts will be much faster.