How to Install Home Assistant under Debian 10

From steamWiki
Revision as of 07:52, 23 March 2020 by Sean (talk | contribs) (Created page with "[ Home Assistant] is an Open Source [ Home Automation] framework that was very easy to setup and get...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

Setup the Environment

  1. Update and upgrade you system by running
    sudo apt update
    sudo apt upgrade
  2. Install some necessary Python3 packages by running
    sudo apt install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev
  3. Create a user (and add him to the dialout group) for Home Assistant by running
    sudo useradd -rm homeassistant -G dialout
  4. 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

  1. Switch to our HA user by running
    sudo -u homeassistant -H -s
  2. Move to the HA install directory by running
    cd /srv/homeassistant
  3. Setup the Python3 Virtual Environment by running
    python3 -m venv .
    source bin/activate

Install and Run Home Assistant

  1. Install Python 3's package installer pip by running
    python3 -m pip install wheel
  2. Install Home Assistant using pip by running
    pip3 install homeassistant
  3. Start Home Assistant by running

Make HA Auto-Start on Boot

  1. Create a new systemd service for Home Assistant by running
    sudo nano /etc/systemd/system/homeassistant.service
  2. Fill in the contents of this new file by running
    Description=Home Assistant
    ExecStart=/srv/homeassistant/bin/hass -c "/home/%i/.homeassistant"
  3. Reload systemd so it will recognized our new service by running
    sudo systemctl --system daemon-reload
  4. Enable our new service by running
    sudo systemctl enable homeassistant

Finish Setup

  1. Visit http://<my_ha_server_name>:8123 on a web browser and follow the prompts to create a new user.