Skip to content
Riccardo edited this page Nov 13, 2015 · 3 revisions

JEMMA as a self-starting gateway

Notes/suggestions to employ when JEMMA is used in remote locations (e.g. running on a Raspberry).

Starting inside Screen at startup

Screen is a simple tool to allow applications to run in background and be "re-attached" locally when needed. They can also be used with other utilities such as screenie to simplify their usage.

A simple script to launch jemma inside a screen in back ground follows (/home/pi/start_screen.sh):

#!/bin/bash

JEMMADIR=/home/pi/jemma
cd $JEMMADIR
echo launching - screen -d -m bash $JEMMADIR/start.sh
screen -d -m ./start.sh

Hooking the start screen at start up

There are several ways to do this. A simple way could be adding this line inside /etc/rc.local

su pi -c /home/pi/start_screen.sh

Create a start screen scirpt

use NVM

In case of reboot it is important to keep devices associated. In order to avoid de-association, the best is to rely on the Non-Volatile Memory (NVM) of ZigBee dongles. This can be done by adding the following lines to org.energy_home.jemma.ah.zigbee.properties file in osgi-instance-area:

#Thu Nov 12 11:00:20 UTC 2015
usenvm=true

Automatic Reboot

Nightly reboots can be life-savers, in case the gateway gets stuck for some reason.

This can be achieved e.g. by creating a file such as /etc/cron.d/zz-reboot with this content:

30 03 * * * root /sbin/reboot

This will reboot the gateway every night at 3:30 AM.

VPN configuration

Many people in the JEMMA community use openvpn. The configuration is project-specific, but it generally boils down to generating dedicated certificates for each gateway (e.g. with xca) and deploying the GW certificates and key + the CA certificate in the gateway.