How to install and configure Home Assistant on a Raspberry Pi already in use

3 minutes of reading
  • Install and configure Home Assistant How applicensee on a Raspberry Pi equipped with Raspbian operating system
  • Difficulty level: bass
  • software installation and configuration

All environments

Notes and disclaimer
  • qualsiasi modifica all'impianto elettrico dev'essere progettata ed effettuata da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 2.3


As explained in other tabs, Home Assistant is the one among the HUB ideal personal to make one profirst personal home automation in an organic and functional way. This crucial software component has the possibility to be installed on many systems and in different ways: Its Raspberry Pi the modality usually favored by the developers is the mode "HASSIO”, or a yes mode fully automatic, which however plans to dedicate the Raspberry Pi for exclusive use di Home Assistant, effectively closing any other features. This mode is described in this specific guide.

This guide covers instead another approccio, or to allow the installation and the functionnamento of Home Assistant on a Raspberry Pi previously installed and configured with Raspbian operating system, which enables us to use Raspberry different and parallel in the very presence of Home Assistant.

A list possible alternatives installation is available here.

Home Assistant Official Logo


Install Raspbian

This guide is dedicated who already has a Raspberry in use with Raspbian operating system. For those who haven't yet prosaw and find themselves having a new Raspberry, perhaps purchased appspecially for making the proFirst of all, then this step of the guide should be unmarked by following another guide, which explains step by step how to configure the Raspbian operating system.

The guide to follow:

Once the Raspbian configuration is finished, it is possible progive in this guide.

Install Home Assistant

Once connected via ssh to the profirst Raspberry (using the "pi" user), perform an update firstnameenvironment:

sudo apt-get update -y
sudo apt-get upgrade -y 
sudo rpi-update
sudo reboot

after the restart caused by the last command, run the following commands to install Python and its dependencies:

sudo apt-get install python3 python3-venv python3-pip python3-dev -y
sudo apt-get install build-essential libssl-dev libffi-dev -y

Then create a user dedicated to Home Assistant, calling it "homeassistant"

sudo useradd -rm homeassistant -G dialout

Let's create now the server installation directory and change the rights by attributing them to users appena created:

cd /srv
sudo mkdir homeassistant
sudo chown homeassistant:homeassistant homeassistant

Now it's time to create the virtual environment in which to execute Home Assistant:

sudo su -s /bin/bash homeassistant
cd /srv/homeassistant
python3 -m venv .
source bin/activate

Once created and had access to the virtual environment (note the change of prompt) you need to install an ad hoc package for Python:

python3 -m pip install wheel

Finally, install Home Assistant through the command:

pip3 install homeassistant

Now it's possible start, for the first time, Home Assistant, executing the command:


The first start will cause the folder to be created automatically ".homeassistant"Under the path"/ Home / homeassistant"And the primary dependencies are installed, always automatically.

Now a few minutes of waiting (from 10 to 20): Home Assistant, at its first execution, prowill see to the installation and automatic configuration of a whole series of accessory components. The wait will end upon receipt, on the screen log, of the string:

INFO (MainThread) [homeassistant.core] Starting Home Assistant

Once the wait is over it will be possible to connect - via the browser of the profirst computer of appoggio - to the web interface of Home Assistant at the url:


where "indirizzoIpRaspeberry”Will be the IP address assigned to your Raspberry; or, more easily:


At this point it is comprofunction has beennamecorrect of Home Assistant, and it is therefore possible to interrupt the execution by pressing CTRL + C, then exit the virtualized environment with:


configuration Home Assistant in autostart on boot

To ensure that Home Assistant start automatically at each boot of the Raspberry Pi, a configuration is required.

Once connected via ssh to the profirst Raspberry (using the "pi" user), run the following command to create the service configuration file:

sudo nano -w /etc/systemd/system/home-assistant@homeassistant.service

Insert the following text in the editor:

Description=Home Assistant

ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"


Then go out and save.
Finally, run the following commands:

sudo systemctl --system daemon-reload
sudo systemctl enable home-assistant@homeassistant
sudo systemctl start home-assistant@homeassistant

At this point Home Assistant will be properly configured for auto boot.

Operational advice

Update Searchnamento

To update Home Assistant, after interrupting the execution, execute the following commands:

sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install --upgrade homeassistant
Changes to the configuration file

The configuration file is located in the directory "/var/homeassistant/.homeassistant" And his name is "configuration.yaml"

Configure home automation accessories

Now you can begin to configure the first accessories of the profirst home automation. To do this it is necessary to make changes to the file "configuration.yaml"; on this issue, we dedicate a guide apposita.

Useful commands

We have dedicated an ad hoc page to the most classic commands in everyday use on Raspbian.

Home Assistant su Raspberry Pi: various installations, things to do

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.

Please comment below