Skip to content

Installation & Autostart

spacemanspiff2007 edited this page Apr 9, 2019 · 4 revisions

Installation

  1. Install required dependencies
sudo apt install python3-dev python3-venv

and navigate to folder where HABApp shall be installed (e.g. /opt/)

cd /opt
  1. Create virtual environment (this will create a new folder "habapp")
python3 -m venv habapp
  1. Go into folder of virtual environment
cd habapp
  1. Activate the virtual environment:
source bin/activate
  1. Upgrade pip
python3 -m pip install --upgrade pip
  1. Install HABApp
python3 -m pip install habapp
  1. Run (or configure it to autostart) PATH_TO_CONFIGURATION_FOLDER
habapp -c PATH_TO_CONFIGURATION_FOLDER

Autostart

To automatically start HABApp after a reboot call

nano /etc/systemd/system/habapp.service

cand copy paste the following contents. If the user which is running openhab is not "openhab" replace accordingly.

[Unit]
Description=HABApp
After=network-online.target

[Service]
Type=simple
User=openhab
Group=openhab
ExecStart=/opt/habapp/bin/habapp -c PATH_TO_CONFIGURATION_FOLDER

[Install]
WantedBy=multi-user.target

Press Ctrl + x to save.

Now execute the following commands to enable autostart

sudo systemctl --system daemon-reload
sudo systemctl enable habapp.service

It is now possible to start and check the status of HABApp with

sudo systemctl start habapp.service
sudo systemctl status habapp.service
Clone this wiki locally