How to install and configure Home Assistant (HASSIO) with Docker on a Raspberry Pi already in use

5 minutes of reading
PURPOSES OF THE GUIDE:
  • Install and configure Home Assistant in mode HASSIO su Docker, therefore to have such personale HUB without losing the functionality offered by the operating system Raspbian Buster
  • Difficulty level: bass
CONCEPTS FACED:
  • software installation and configuration
SOFTWARE COMPONENTS USED:
Prerequisites:
PHYSICAL DEVICES USED:
GUIDE MOST INDICATED FOR:

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: 3.2 - 18 / 08 / 2019

Abstract

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.

Installation of Home Assistant in mode HASSIO yes it has the disadvantage of dedicating a Raspberry unit for its exclusive use, but presents the advantage to provide the user, in ordinary use, with an element absent in other types of installation: "'sadd-on store". In essence, it is a list of additional components (MQTT, Samba, SSH, Node-RED and many others) installable and configurable directly from the interface of Home Assistant, making it much easier to customize theHUB.

On the other hand, an installation of Home Assistant traditional (Raspberry with Raspbian + operating system Home Assistant installed by hand) makes the Raspberry available also to other parallel uses, but provides that Home Assistant (and any additional components) come completely installed and configured manually in mode applicativa, losing, among other things, some simplifications of the method HASSIO.

The solution that saves goat and cabbage exists, and is described in this guide.

In practice it is about install Raspberry in conventional mode (so with the profirst Raspbian operating system) then adding a container ("container") in which to execute HASSIO. A container is a virtual environment that "make believe"The HASSIO to be in an environment all its own, like appgreasy a Raspberry dedicated to it: this allows its execution and, at the same time, leaves the user with the "room for maneuver" desired by the Raspbian operating system. The type of container used will be Docker.

Nb The installation method described in this guide is functional, certified, SOLO su Raspberry model 3B, 3B +, 4B with operating system Raspbian Buster (Full or Lite).
In case of use Raspbian Stretch, we recommend to upgrade to Buster.

A list of the possible alternative for the installation of Home Assistant is available here.

Home Assistant Official Logo

Prosubsidence

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 complete (including the possibility to connect to it) via SSH) it's possible proyield in this guide.

Docker

INSTALLATION

Once connected via ssh to profirst Raspberry (taking care to use the user "pi“), Perform an update firstnameenvironment through the following commands:

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

Subsequently to reboot caused by the last command, run the following commands:

sudo apt-get install apt-transport-https ca-certificates curl avahi-daemon dbus -y
sudo apt-get install jq apparmor-utils socat software-properties-common -y

And now advised install the package "network-manager“, Which is not strictly necessary but advised (its absence is reported with a warning at Docker). ATTENTION: We have noticed that the command that installs it (below) causes in some cases a disconnection of the network if performed via connection Wi-Fi (which stops working): it is therefore advisable to run it taking care (at least for the execution of this command) to connect the profirst Raspberry alla profirst home network via its LAN ethernet port and not by connection Wi-Fi:

sudo apt-get install network-manager -y

Finally complete with a reboot:

sudo reboot

Once restarted the operating system, reconnect and run the following commands (caution: copy the following strings for their entirety):

curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -
echo "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install docker-ce -y
CONFIGURATION

At this point we need to refine the configuration. We will then modify the file "/boot/cmdline.txt"

sudo nano /boot/cmdline.txt

In the editor who appit will come up, let's position ourselves at the bottom of the text and add the following line:

cgroup_enable=memory cgroup_memory=1

Let's go out and save (CTRL + X, Y, Enter).
Finally, reboot the Raspberry to make the changes effective:

sudo reboot
Verifications

To verify that Docker is correctly installed, execute the following command:

sudo docker run armhf/hello-world

To confirm the quality of the installation and execution of Docker, the output must be similar to the following:

Unable to find image 'armhf/hello-world:latest' locally
latest: Pulling from armhf/hello-world
a0691bf12e4e: Pull complete 
Digest: sha256:9701edc932223a66e49dd6c894a11db8c2cf4eccd1414f1ec105a623bf16b426
Status: Downloaded newer image for armhf/hello-world:latest

Hello from Docker on armhf!
This message shows that your installation appears to be working correctly.

Install HASSIO on Docker

After restarting, reconnect to our Raspberry via SSH and become superuser:

sudo -i

and we launch the installation of HASSIO:

curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s -- -m raspberrypi3

At this point let's take a break: the following activity could take up to 20-25 minutes, depending on the speed of your Internet connection and the performance of the Raspberry.

An indication of correct progress is undoubtedly the log entry:

[Info] Install supervisor Docker container

At the end - if everything goes well - the terminal will report the following log entry:

[Info] Run Hass.io

which identifies the completion of the activity.
Finally:

exit

First access on Home Assistant

spent a few minutes from the end of the proprocedure, HASSIO will finally be running on our Raspberry. To discover the Raspberry IP it will be sufficient to execute the command:

ifconfig

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 192.168.0.0/16.
Discovered the IP, access to HASSIO pointing on proYour browser has the following address:

http://indirizzo_ip_raspberry:8123

or

http://hassio.local:8123

Nb If the connection via this last address fails, make sure that on proyour router is enabled with multicast DNS (mDNS).

Finishing

At this point HASSIO and yes pronto, but there are some perfectionsnamenti, which derive from the installation of additional components we consider "essential", to be implemented.

This done, it is possible to begin to add components that can be integrated into the proprio HUB. To the topic related to the configuration file of Home Assistant dedicated a guide apposita.

LOG

To view the hassio installation LOGs, use the following command:
sudo docker logs hassio_supervisor


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