DIY Projects

Cayenne: Install the librairie on an Orange Pi under Armbian Jessie

cayenne orange pi lite dashboard

In this new tutorial on the Cayenne platform for connected objects IoT, we will install the necessary resources on an Orange Pi Lite (Wi-Fi version). Cayenne is still in the development phase. For now there is only Raspberry Pi that is supported, and still the official Raspbian distribution. Armbian (which I systematically use on all my Orange Pi models) is based on Debian Jessie just like Raspbian. So there should be no problem 🙂

How to verify that the Armbian distribution is compatible with Cayenne?

First, let’s see if the Armbian distribution is compatible. If you use the desktop version, there is a good chance that it does not work. The node of the problem in the current installation script resides in the size of the temporary folder (/tmp). This must at least be at least 200MB. I have not gone further in my investigations yet. There are few other limitations (packages absent …).

For the Armbian distribution used, run the cat /etc /*- release  command. Here we have Armbian based on Debian Jessie

root@orangepilite:~# cat /etc/*-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=orangepilite
BOARD_NAME="Orange Pi Lite"
VERSION=5.26.170214
LINUXFAMILY=sun8i
BRANCH=dev
ARCH=arm
IMAGE_TYPE=nightly
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

There is no indication on Linux Kernel. For this tutorial, I installed Cayenne on version 4.10.0 To retrieve the version of the Kernel, run the command uname -a .

root@orangepilite:~# uname -a
Linux orangepilite 4.10.0-sun8i #4 SMP Mon Feb 13 02:46:43 CET 2017 armv7l GNU/Linux

If you have found how to install Cayenne on the Desktop version of Armbian, feel free to share in the comments or contact me via the contact form.

Add Orange Pi from the Cayenne mobile app

Start the Cayenne application on your iPhone or Android smartphone. It is available from the App Store or the Play Store. Click on the + in the upper right corner of the screen. Choose Raspberry Pi

Then Continue at the bottom of the screen

Cayenne is able to find a single Raspberry Pi on your local network. For Orange Pi, we will have to help him a little. Click Advanced Discovery Settings.

Enter the IP address of the Orange Pi on the screen that appears. Do not look for the dot (.), Cayenne uses the comma as the separator.

Click Use IP to start the search. A nice animation starts to make us wait.

If Cayenne found the Orange, a form is displayed. Enter your SSH credentials. User, password, and SSH port. By default, it is the 22. Done to finish the entry. Then there’s a little trap. You must check the device by clicking on the line. A small blue check mark appears on the left. You can install Cayenne on several Orange or Raspberry Pi at the same time (you’re in luck!). Start the installation of the libraries by pressing Setup selected devices.

It’s gone for a while (depending on the hardware and your internet connection).

What happens during the installation phase?

The Cayenne application opens a secure SSH connection from the mobile application and launches a script that will install the necessary resources on Armbian. It is quite easy to follow what is happening during this phase. Connect to SSH for example. Move to the root directory (~) and list the files (ls).

root@orangepilite:~# ls
cayenne.err  cayenne.out  rpi_a69jafo40f.sh
root@orangepilite:~#

There are 3 files:

Let’s look more closely at what it consists of

#!/bin/bash
# myDevices setup script
set -e
NAME="$0"
PREFIX="myDevices-1.0"
HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo $NAME
codeRaw="${NAME##*_}"
inviteCode="${codeRaw%.*}"
if [ -d "/etc/myDevices" ]; then
   echo "dir exists"
   if ! grep -q InviteCode /etc/myDevices/AppSettings.ini ; then
       echo "Invite code does not exist but directory does so we will add invite code"
       sed -e "/Agent/ a InviteCode = $inviteCode" </etc/myDevices/AppSettings.ini>/etc/myDevices/NewAppSettings.ini && mv /etc/myDevices/NewAppSettings.ini /etc/myDevices/A$
       sed "s/Initialized = .*/Initialized = false/g" </etc/myDevices/AppSettings.ini>/etc/myDevices/NewAppSettings.ini && mv /etc/myDevices/NewAppSettings.ini /etc/myDevice$
       sed '/Id = /d' </etc/myDevices/AppSettings.ini>/etc/myDevices/NewAppSettings.ini && mv /etc/myDevices/NewAppSettings.ini /etc/myDevices/AppSettings.ini
       sudo service myDevices stop
       sudo service myDevices start
       exit;
   fi
fi
echo "continuing as new install..."
wget -O $HOME/$PREFIX.tar.gz "http://updates.mydevices.com/raspberry/myDevices-1.0.tar.gz"
tar -xzvf $HOME/$PREFIX.tar.gz
cd $HOME/$PREFIX
chmod +x $HOME/$PREFIX/setup.sh
bash -x $HOME/$PREFIX/setup.sh -code "$inviteCode" "$@"

Cayenne will be installed in the / etc / myDevices folder. The code is downloaded from the Cayenne server. Once recovered, the project is decompressed and the script setup.sh nano executed.

What can you do with Cayenne on Orange Pi?

Once installed, let’s see what it is possible to do with Cayenne on a Orange Pi. Let’s say it directly, all Orange PI devices are currently still unusable:

All the work has been done for the Raspberry Pi which remains the undisputed leader of the field. But then what is left?

The Dashboard gathers useful information on the health of Orange Pi:

In addition, the shutdown and restart functions work. I have not yet tested the remote desktop fault installed on my Armbian. Cayennne using TightVNC (explained in this tutorial), this should work.

The CPU load in detail.

Memory

The usage level gauge of the SD board does not work but the information is collected correctly on the detail page.

Finally, temperature monitoring. The curve of Beziers deserves a small adjustment.

Calendar (Schedule)

Cayenne integrates the trigger action on a calendar. An action can be punctual or repeated. Without the possibility of adding actuators or sensors, the calendar has a very limited interest on Orange Pi. You can program the shutdown every night for example. We could also do it with a cron directly on the Orange!

Event trigger (Triggers)

Finally, last tool proposed by Cayenne, the trigger of event (trigger). To create a trigger, click the most ur in the upper-right corner of the screen.

Cayenne works on the IF … THEN principle (if this happens … then do that). The list of triggers is still very short: online / offline, storage level, CPU load, memory level. For example, we will trigger the sending of an alert email if the Orange Pi is offline (loss of connection off). It is interesting if the OPI is used for a home automation server (Jeedom, Domoticz …).

Check the device concerned by the monitoring and then specify the destination email and a mini message.

The shutter release button is ready. You can enable or disable it at any time.

And here is the email received when the Orange Pi stops or is offline (attention, maybe the Internet connection is cut).

Conclusion

It is therefore also easy to install Cayenne on the Orange Pi running under the Armbian Jessie (server) distribution as on Raspbian but apart from remotely monitoring and restarting the Orange Pi, it is not possible to enjoy the GPIO, Of the camera … which makes the whole interest of the Raspberry Pi. One must be patient, maybe things will move if the Orange Pi community grows enough. To be continued …

Click to rate this post!
[Total: 1 Average: 5]
Exit mobile version