Install Appdaemon in virtual environment on Orange Pi

Appdaemon is a piece of software, designed to work with Home Assistant. It can be used to write automations in python. The reason I want it to run in a virtual environment is because of appdaemon uses different versions of the same software. On a test computer with Home Assistant and Appdaemon not in a virtual environment, I was not able to update Home Assistant anymore. With the virtual environment, there is a beautiful separation of the software.
One of the applications is HADashboard. With this application, we can make dashboards that beautiful interface on screens. I will use this on a computer with a touchscreen, mounted to a wall.

Install Appdaemon

Set up dependencies

Ther was only one extra dependency I needed to install. Note that packages like python3.6-pip and  python3.6-dev are also needed, but I installed these already for Home Assistant. Install the missing dependency with the following command:

$ sudo apt-get install libffi-dev

Set up a virtual environment and install Appdaemon

For setting up the virtual environment, I followed approximately the steps described on the Home Assistant website. I only installed Appdaemon instead.

First, a new user is made.

$ sudo useradd -rm appdaemon -G dialout

Next, we will create a directory for the installation of Appdaemon and change the owner to the appdaemon account.

$ cd /srv 
$ sudo mkdir appdaemon
$ sudo chown appdaemon:appdaemon appdaemon

Next up is to create and change to a virtual environment for Appdaemon. This will be done as the appdaemon account.

$ sudo -u appdaemon-H -s
$ cd /srv/appdaemon
$ python3.6 -m venv .
$ source bin/activate

Once you have activated the virtual environment you will need to run the following command to install a required python package.

$ python3.6 -m pip install wheel

Once you have installed the required python package it is now time to install Appdaemon!

$ python3.6 -m pip install --pre appdaemon

Copy the compile files to the correct place

Now we will create a new file (and directory if needed) at /home/appdaemon/conf/appdaemon.yaml. Herein we add the following lines:

  threads: 10
      type: hass
      ha_url: http://<ha-ip-address>:8123
      ha_key: "<password>"
  dash_url: http://<ha-ip-address>:5050

In the conf folder, we also need to add a “compiled” folder. Herein, there are the skins for the dashboards. Get them from here (TODO where are they?) and past them in this folder.

Dashboards will be made in another folder in conf, called “dashboards”. Finally, the /home/appdaemon/conf folder should look like this (ls command) :

appdaemon.yaml compiled dashboards

Create an autostart script

A service script needs to be made. Make it in the /etc/systemd/system folder and name it appdaemon@appdaemon.service. If the installation is made just as described above, no changes should be necessary. Check if the required Home Assistant service is named correctly! (See your own installation of Home assistant)


ExecStart=/srv/appdaemon/bin/appdaemon -c "/home/appdaemon/conf/"


Now reload the service daemon, enable the script and start appdaemon. If everything goes well, you should be able to connect to http://<ha-ip-address>:5050. A white screen will be seen as long as there is no “dashboards” folder with a dashboard inside. Making a dashboard can be found easily on the internet.

Extra: add extra skins

On the internet, custom skins can be found and downloaded. In the conf folder, make a new “custom_css” folder and add the skin. With a restart of Appdaemon, the new skin will be available.

Leave a Reply

Your email address will not be published. Required fields are marked *