Installation

Following instructions assumes that the HAASP is installed to a Debian based Linux OS

Install dependancies

sudo apt-get update
sudo apt-get install git python-pip python-all-dev
sudo pip install -U pip virtualenv

Install libHAASP

mkdir ~/.haasp
cd ~/.haasp
virtualenv env
~/.haasp/env/bin/pip install -U git+https://git.cmtec.se/haasp/libhaasp.git

Install HAASP core

cd ~/.haasp
virtualenv env
~/.haasp/env/bin/pip install -U git+https://git.cmtec.se/haasp/haasp_core.git

Install HAASP application

~/.haasp/env/bin/haasp_install <APP> --ip <CORE_IP> --subname <SUBNAME>
–ip is optional and should be used if application and core is running on different hardware
–subname is optional and should be used if multiple instances of the application needs to be running

Install HAASP cli on remote/seperate computer

Make sure you have python3, git and pip installed
pip install --user -U git+https://git.cmtec.se/haasp/haasp.git
pip install --user -U git+https://git.cmtec.se/haasp/haasp_cli.git

To run the cli then add the ip for the core to the command haasp_cli --ip <CORE_IP>

Enable autostart

Create file /etc/init.d/haasp and add following code (sudo vi /etc/init.d/haasp):

#! /bin/sh
### BEGIN INIT INFO
# Provides:          haasp
# Required-Start:    $remote_fs $local_fs $network $named $time $syslog
# Required-Stop:     $remote_fs $local_fs $network $named $time $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: HAASP init script
# Description:       HAASP nit script
### END INIT INFO

USER=pi

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting haasp"
    # run application you want to start
    sudo -u $USER /home/$USER/.haasp/core/env/bin/haasp start
    ;;
  stop)
    echo "Stopping haasp"
    # kill application you want to stop
    sudo -u $USER /home/$USER/.haasp/core/env/bin/haasp stop
    ;;
  restart)
    echo "Restarting haasp"
    # kill application you want to stop
    sudo -u $USER /home/$USER/.haasp/core/env/bin/haasp restart
    ;;
  *)
    echo "Usage: /etc/init.d/haasp {start|stop|restart}"
    exit 1
    ;;
esac

exit 0

Change the USER=pi if you don’t use pi as user.

Make the init file executable:
sudo chmod +x /etc/init.d/haasp

Enable autostart of the file:
sudo update-rc.d haasp defaults

Make sure the user have privilege to run the init file as sudo without password prompt. If not then add following code to visudo:

# User privilege specification
%users ALL=(ALL) NOPASSWD: /etc/init.d/haasp