You should see the bash prompt change to the homeassistant user. Next we need to switch to the homeassistant user in order to activate the virtual environment. sudo chown homeassistant:homeassistant /srv/homeassistant Next we need to set the permissions for the new folder to allow our homeassistant user access. Remember that virtual environment thing we talked about earlier? Now it is time to create a wrapper for Home Assistant. sudo useradd -rm homeassistant -G dialout,gpio,i2c Activate virtual environment This will allow the Home Assistant core to have access to some of the necessary hardware peripherals on the Pi. We also need this user to have access to the GPIO, I2C and dialout groups. It is best just to call this user ‘ homeassistant‘ although you can choose a different name if you like. We need to create a new user within Raspbian for the Home Assistant core. sudo apt-get install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev Create homeassistant user These are packages that will be installed within Raspbian that are needed to install and run Home Assistant. In order to run Home Assistant we need to add some additional dependencies.
sudo apt-get update sudo apt-get upgrade -y Install dependencies
Go ahead and enter the following commands into the terminal. The first thing to do is run the Raspbian update commands to make sure that everything on the system is up to date. The platform that we will use is called virtualenv, abbreviated as venv. This allows Home Assistant and all dependencies to be installed in a separate wrapper so as not to disrupt other programs that we might want to run on the Pi. We will be installing Home Assistant inside of something called a virtual environment. This can either be done by connecting a screen and keyboard to the Pi or by using SSH to connect over the network. We will need to access the Raspberry Pi with the terminal in order to enter the commands required to install Home Assistant. Make sure you install Raspbian Lite, the command line only flavour of Raspbian.
It is recommended that you use a Raspberry Pi 3 or 4 due to the system resource requirements, however you can run it on other Raspberry Pi boards.
If you are new to the Raspberry Pi ecosphere and you have not yet installed Raspbian, go check out my tutorial that explains how to install Raspbian and access the terminal using SSH. You will of course need a Raspberry Pi with the latest version of Raspbian Lite. The installation of Home Assistant as a service within Raspbian leaves you open to do more with your Pi and it is ideal for those who don’t want to dedicate their entire Pi just to Home Assistant. The Raspbian installation is for advanced users. If you are new to Home Assistant (and want the add-on store) or you want as little to do with the terminal as possible then you follow the standard Home Assistant installation. Ever found the standard installation of Home Assistant frustrating because you cannot access the root? Want the freedom to run other services on your Pi and access the bash prompt as normal? What you need is the Home Assistant Raspbian installation.