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

4 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.5


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 following address:


Nb In case you can't connect, make sure on proown router DNS multicast (mDNS) is active. If it isn't, the name resolution “hassio.local"Is not successful and the browser is unable to connect: the solution, for theappanointed, is to activate multicast (which prosee this thing). Alternatively, however, it is always possible to connect to the direct address, that is http://INDIRIZZO_IP_DEL_RASPBERRY:8123, where the IP address is the one assigned by the router to Raspberry Pi.

To find out the IP of the Raspberry, simply run the command:


which will list the IPs associated with the raspberry:

Raspbian ifconfig

TheIP address it is usually indicated to the right of the word "inet"And usually is part of the subnet
Discovered the IP, access to HASSIO pointing on profirst browser the following address, as explained before:


Once connected it should appto set up a site similar to this:

Home Assistant - Onboarding
Which allows you to set the first, elementary and personal "onboarding" information related to the profirst home automation.

Compliments! Home Assistant It is running.

At this point it is comprofunction has beennamecorrect of Home Assistant, and it is therefore possible to interrupt its execution by pressing CTRL + C.

At this point it is possible (if you want, for the moment) turn off the Raspberry Pi through the command:

sudo shutdown now

Nb The command "turns off" the operating system, but electrically the Raspberry will go off Manually (when the green LED is permanently off, which indicates that the shutdown of the operating system has been completed).

configuration Home Assistant in autostart on boot

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

Once connected via ssh al proprio Raspberry (always using the "pi" user), run the following command to start the text editor ("nano") and create the service configuration file:

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

Enter in the editor that appthe following text will arrive:

Description=Home Assistant

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


Then exit and save (CTRL + X, Y, enter).
Finally, run the following commands that "load" and enable and start the service:

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

At this point Home Assistant will be started and configured correctly for auto start.

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 (here a card that explains in detail what it is) is located in the directory:


Useful commands

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


What to do now? Consult the card which illustrates all the things to do after this one first installation, here's what! 🙂

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.


Stay up to date through ours Telegram channel!