On to installing Home Assistant on our device. Like with the KODI installation, this is mostly information widely available on the internet, yet again included within this series for compleness sake. So let’s get started with installing the dependencies if not yet installed. (Not really sure anymore, sorry for this)
[bash] sudo apt-get install python3 python3-venv python3-pip[/bash]
Next we need to create a dedicated user for running the software. This is recomended by the developers of Home Assistant, so will follow their advise to do so. Run the following commands;
[bash] sudo useradd -rm homeassistant -G dialout,gpiocd /srv
sudo mkdir homeassistant
sudo chown homeassistant:homeassistant homeassistant
[/bash]
Now we will change our environment to that new user and create a virtual environment for installing the software.
[bash] sudo -u homeassistant -H -scd /srv/homeassistant
python3 -m venv .
source bin/activate
[/bash]
Next is to install some dependencies within this virtual environment
[bash] python3 -m pip install wheel[/bash]
And then we can finally install Home Assistant itself
[bash] pip3 install homeassistant[/bash]
If everything went OK, we can start Home Assistant manually for the first time.
[bash] hass[/bash]
Running Home Assistant for the very first time will take a while as it is downloading and installing all other things it needs at start up. The documentation mentions 5 – 10 minutes. Best is to keep checking the webpage at the device it’s IP:8123. Once the GUI is all ready, we can stop Home Assistant and carry on.
[bash] CTRL-Cexit
[/bash]
Let’s create the systemd autostart at boot file, so that HASS get’s started at boot.
[bash] sudo nano -w /lib/systemd/system/home-assistant@homeassistant.service[/bash]
And insert the following content
[bash] [Unit] Description=Home AssistantAfter=network-online.target [Service] Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant" [Install] WantedBy=multi-user.target
[/bash]
And then finally onto the last step to enable the service
[bash] sudo systemctl –system daemon-reloadsudo systemctl enable home-assistant@homeassistant
reboot
[/bash]
In one of the next blog post I will get into connecting Mycroft with HASS and of course vica versa, connecting HASS with Mycroft.
Do you like what you just read? Keep me going by donating on Paypal or become a Patron.