Difference between revisions of "How to Install Home Assistant under Debian 10"

From steamWiki
Jump to: navigation, search
(Updating Home Assistant)
 
Line 27: Line 27:
  
 
=Updating Home Assistant=
 
=Updating Home Assistant=
##Switch to our HA user by running <pre>sudo -u homeassistant -H -s</pre>
+
#Switch to our HA user by running <pre>sudo -u homeassistant -H -s</pre>
 
#Move to the HA install directory by running <pre>cd /srv/homeassistant</pre>
 
#Move to the HA install directory by running <pre>cd /srv/homeassistant</pre>
 
#Activate the Python3 Virtual Environment by running <pre>python3 -m venv .&#10;source bin/activate</pre>
 
#Activate the Python3 Virtual Environment by running <pre>python3 -m venv .&#10;source bin/activate</pre>
 
#Update Home Assistant by running <pre>pip3 install --upgrade homeassistant</pre>
 
#Update Home Assistant by running <pre>pip3 install --upgrade homeassistant</pre>

Latest revision as of 11:55, 30 November 2021

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
    hass

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
    [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
  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.

Updating Home Assistant

  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. Activate the Python3 Virtual Environment by running
    python3 -m venv .
    source bin/activate
  4. Update Home Assistant by running
    pip3 install --upgrade homeassistant