From the Home Assistant project page:
Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server.
Currently there aren't official Debian packages; see this bug report.
- This documentation has been tested in Debian Buster running as an LXC container on a Turris Omnia router. It may work in other LXC host installs.
When installing this to a Turris Omnia device, make sure you've read their LXC documentation, specially the warning about damaging internal storage and recommendation to install on SSD / USB storage instead.
Initial Debian LXC container install on Turris Omnia
This assumes /srv/lxc is the mount point for LXC storage.
Login to your router as root, create the LXC container:
# lxc-create -t download -n lxc-ha
You will need to specify Debian, Buster and armv7l as the choice for Linux distribution and platform.
Start the newly created container and configure its hostname (we'll use ha), the reboot it:
# lxc-start -n lxc-ha
# lxc-attach -n lxc-ha
# echo ha > /etc/hostname
Get the MAC address from the network interface using the ip a command, this will be used to assign an address on your DHCP server. Reboot the container and verify it's been assigned the desired IP address.
Optionally install byobu (tabbed multi-window management in terminal sessions), nano (text editor) and openssh-server on the LXC container itself, this will make it easier to remotely manage it:
# apt install byobu openssh-server nano && byobu-enable
Don't fdorget to harden your SSH server installation and use only public key authentication, specially if your Home Assistant server will be accessible on a public network!
Installing the required dependencies and Home Assistant
Several packages are required before installing Home Assistant:
# apt install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev sudo ash
Two groups may be needed when dealing with GPIO and i2c devices. A new user used to run Home Assistant then needs to be created and added to such groups:
# groupadd gpio
# groupadd i2c
# useradd -rm homeassistant -G dialout,gpio,i2c
Next we'll create a directory for the installation and assign proper rights to it:
mkdir -p /srv/homeassistant && chown homeassistant:homeassistant homeassistant
Next up is to create and change to a virtual environment. This will be done as the homeassistant account:
# sudo -u homeassistant -H -s
$ cd /srv/homeassistant
$ python3 -m venv .
$ . bin/activate
Once you have activated the virtual environment (notice the prompt change) you will need to run the following command to install a required python package.
(homeassistant) homeassistant@ha:/srv/homeassistant $ python3 -m pip install wheel
Once you have installed the required python package it is now time to install Home Assistant! This may take 5-10 minutes as it download and installs libraries and dependencies and is only required once.
(homeassistant) homeassistant@ha:/srv/homeassistant $ pip3 install homeassistant
Start Home Assistant for the first time. This will complete the installation for you, automatically creating the .homeassistant configuration directory in the /home/homeassistant directory, and installing any basic dependencies:
(homeassistant) $ hass
You can now reach your installation on your network over the web interface on http://ipaddress:8123.
For more details and for automatic startup of your Home Assistant installation, make sure you fully read and understand the official manual installation instructions for a RaspberryPi, in a Python virtual environment.