Installation of Home Assistant

Lars Jönsson 2021-02-09

Information about how to install Home Assistant on a Raspberry Pi. It is based on the instructions at:

Install Home Assistant

Install image

Razberry Z-wave (optional)

The Razberry Z-wave board uses the UART that is normally used by Bluetooth. By using a device overlay called miniuart-bt, Bluetooth will use another UART freeing up the UART at /dev/ttyAMAO to be used by the Razberry board.

Add the following line at the end of the /config.txt file on the boot partition of the SD card.

dtoverlay=miniuart-bt

More information is available at:

Configuration

Format a USB stick to FAT32 with the volume name CONFIG.

Wireless LAN WPA/PSK

Create a folder named network in the root of the newly-formatted USB stick.

Within that folder, create a file named my-network without a file extension.Insert the following into the file. Replace MY_SSID with the SSID of the network and MY_WLAN_SECRET_KEY with the secret key.

[connection]
id=my-network
uuid=72111c67-4a5d-4d5c-925e-f8ee26efb3c3
type=802-11-wireless

[802-11-wireless]
mode=infrastructure
ssid=MY_SSID
# Uncomment below if your SSID is not broadcasted
#hidden=true

[802-11-wireless-security]
auth-alg=open
key-mgmt=wpa-psk
psk=MY_WLAN_SECRET_KEY

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

Static IP (optional)

Replace the following configuration in the my-network file:

[ipv4]
method=manual
address=192.168.1.111/24;192.168.1.1
dns=8.8.8.8;8.8.4.4;

For address, the value before the semicolon is the IP address and subnet prefix bitlength. The second value (after the semicolon) is the IP address of the local gateway.

First start of the board

Configuration after startup

When the installation is ready, you will prompted to create an user account. Create it and log in.

Configure the home location.

Add-ons

The following add-ons are more or less a must, to be able to manage the Home Assistant in a simple way.

The following add-ons are needed to be able to use Tellstick and Zigbee:

ZWave is today build into Home Assistant and need no add-on. There is work ongoing move to use add-ons for Zwave. The add-ons Mosquitto broker and OpenZWave are then used. Another useful add-on is Node-RED, which is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.

File editor add-on

The file editor is used for editing the configuration files. Even though many things can be configured by using the GUI, some things are still configured via files. Everything (or almost everything) configured via the GUI is put into files that can be edited by the File editor.

Install the add-on and start it. Enable Show in sidebar. No configuration is needed for normal use.

Terminal & SSH add-on

Sometimes it is needed to login to the CLI of Home Assistant. This add-on enables login via SSH.

This add-on is only availble if the user is set to Advanced mode.

Install the add-on. Some configuration is necessary. You need enable the port for external access. You can just enter 22 as value or any other value like you want. Enter authorized_keys (preferred) or password. Start the add-on.

Standard SSH access

Login as root to either homeassistant.local or to the IP address (X.X.X.X) of Home Assistant.

ssh root@homeassistant.local

  --- or ---

ssh root@X.X.X.X

Debug SSH access

Sometimes it is vital to access the OS of Home Assistant for debug purposes. More information is available at Debugging the Home Assistant Operating System.

Install the public key to Home Assistant by putting the file on an USB stick that is named CONFIG. The previously used USB stick can be reused. Put the public key in a file named authorized_keys on the root of the USB stick. Connect the USB to the board. Either use IMPORT FROM UAB in Home Assistant (Supervisor -> System) or reboot the board to update copy the public key to the board.

Port 22222 is used for debug login. Login as root to either homeassistant.local or to the IP address (X.X.X.X) of Home Assistant.

ssh root@homeassistant.local -p 22222

  --- or ---

ssh root@X.X.X.X -p 22222

Enter login at the ha > prompt to access the host system of the board.

 _    _                                         _     _              _   
| |  | |                          /\           (_)   | |            | |  
| |__| | ___  _ __ ___   ___     /  \   ___ ___ _ ___| |_ __ _ _ __ | |_ 
|  __  |/ _ \| '_ ` _ \ / _ \   / /\ \ / __/ __| / __| __/ _` | '_ \| __|
| |  | | (_) | | | | | |  __/  / ____ \\__ \__ \ \__ \ || (_| | | | | |_ 
|_|  |_|\___/|_| |_| |_|\___| /_/    \_\___/___/_|___/\__\__,_|_| |_|\__|

Welcome on Home Assistant command line.

For more details use 'help' and 'exit' to close.
If you need access to host system use 'login'.

ha > login
#

Tellstick add-on

Install the add-on. All switches that are controlled by Tellstick needs to be configured.

Example:

devices:
  - id: 1
    name: Balkong
    protocol: arctech
    model: 'selflearning-switch:nexa'
    house: '231893'
    unit: '1'

The configuration.yaml file also needs to be updated to include Tellstick:

# Example configuration.yaml entry
tellstick:
    host: core-tellstick
    port: [50800, 50801]

Sensors are auto-detected by Tellstick, but the id of each sensor needs to be added to configuration.yaml.

# Example configuration.yaml entry
sensor:
  - platform: tellstick
    only_named:
      - id: 222
        name: Gästrum
      - id: 117
        name: Balkong
      - id: 213
        name: Sovrum

Use the list-sensors function to get the id of all sensors. It is described in the Service calls section in the add-on documentation of Tellstick.

deCONZ add-on

This is used to control a Zigbee network with ConBee II.

Install the add-on and configure it. The device needs to be set and if VNC is used the vnc_password also needs to be set.

device: /dev/ttyACM0
vnc_password: MY-SECRET

When using VNC, the port number have to be set in the Network section of the add-on configuration. It is adviced to use 5900.

Configure Home Assistant

If you have an old Home Assistant you can copy the configuration files. The easiest way is to use File edit and copy the desired content to the new Home Assistant.

Another way is to restore a snapshot from the old Home Assistant, but it requires that both Raspberry Pi:s are of the same sort and that everything on the old Home Assistant is updated to the latest versions.

Setup of SSL/TLS is covered in a separate topic.