How to Install Home Assistant under Debian 10
From steamWiki
Home Assistant is an Open Source Home Automation framework that was very easy to setup and get running. I'm not going to lie, I first tried OpenHAB (it was billed as being the oldest, most stable, and best community supported system) but was unable to ever get it working right. Home Assistant worked "right out of the box". This is a quick write-up on how to install it under Debian 10.
Contents
Setup the Environment
- Update and upgrade you system by running
sudo apt update sudo apt upgrade
- Install some necessary Python3 packages by running
sudo apt install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev
- Create a user (and add him to the dialout group) for Home Assistant by running
sudo useradd -rm homeassistant -G dialout
- Create an Install Directory for Home Assistant and set the permissions by running
sudo mkdir /srv/homeassistant sudo chmod homeassistant:homeassistant /srv/homeassistant
Create and move to the Virtual Environment
- Switch to our HA user by running
sudo -u homeassistant -H -s
- Move to the HA install directory by running
cd /srv/homeassistant
- Setup the Python3 Virtual Environment by running
python3 -m venv . source bin/activate
Install and Run Home Assistant
- Install Python 3's package installer pip by running
python3 -m pip install wheel
- Install Home Assistant using pip by running
pip3 install homeassistant
- Start Home Assistant by running
hass
Make HA Auto-Start on Boot
- Create a new systemd service for Home Assistant by running
sudo nano /etc/systemd/system/homeassistant.service
- Fill in the contents of this new file by running
[Unit] Description=Home Assistant After=network-online.target [Service] Type=simple User=%i ExecStart=/srv/homeassistant/bin/hass -c "/home/%i/.homeassistant" [Install] WantedBy=multi-user.target
- Reload systemd so it will recognized our new service by running
sudo systemctl --system daemon-reload
- Enable our new service by running
sudo systemctl enable homeassistant
Finish Setup
- Visit http://<my_ha_server_name>:8123 on a web browser and follow the prompts to create a new user.
Updating Home Assistant
- Switch to our HA user by running
sudo -u homeassistant -H -s
- Move to the HA install directory by running
cd /srv/homeassistant
- Activate the Python3 Virtual Environment by running
python3 -m venv . source bin/activate
- Update Home Assistant by running
pip3 install --upgrade homeassistant