Raspberry Pi

FrandSX edited this page Jan 10, 2017 · 2 revisions
Clone this wiki locally

This document explains the steps to install OpenRemote Controller on Raspberry Pi.

  1. Install Raspbian OS
  2. Install Java Virtual Machine
  3. Install OpenRemote Controller
  4. Sync your Controller with Designer
  5. Set OpenRemote to Run as a Service
  6. The Final Step

Install Raspbian OS

The current version of Raspbian at the time of this writing is Raspbian Jessie. The full version, Raspbian Jessie with PIXEL, is unnecessary for OpenRemote, so this guide uses Raspbian Jessie Lite, a minimal version of the operating system. Both versions of the OS are equally capable of running OpenRemote.

If you choose to install Raspbian Jessie with PIXEL instead of Raspbian Jessie Lite, skip step 2, because Java is included in full Jessie.

Download Jessie Lite from: https://www.raspberrypi.org/downloads/raspbian/

Then follow these instructions to set up the OS on your SD card: https://www.raspberrypi.org/documentation/installation/installing-images/

After you have installed the image, and your Pi starts up for the first time, it is time to go through the various configuration options: https://www.raspberrypi.org/documentation/configuration/raspi-config.md

This guide doesn't go to the details of configuring a Raspberry Pi, but the following actions in raspi-config are recommended:

  • Expand the SD file system so your full SD card capacity is used
  • Set the network name of your Pi to your liking
  • Adjust the memory split, leave only a minimal amount of RAM for graphics (e.g. 16MB)
  • Enable SSH for remote management
  • Change the default password (or use SSH)

Optionally, give your Raspberry Pi a static IP address.


Install Java Virtual Machine

OpenRemote can be run with a number of different JVMs, but this guide uses the Oracle Java 8, because it is the default option on Raspbian Jessie with PIXEL. To install, use the following command on the command prompt:

$ sudo apt-get install oracle-java8-jdk 

Install OpenRemote Controller

First set up your OpenRemote account: http://www.openremote.com/create-your-account/

When all the steps involved in the above are done, type the following commands in your Raspbian command prompt to install OpenRemote Controller on your Raspberry Pi:

Go to your home directory

$ cd

Download OpenRemote Controller

$ wget https://github.com/openremote/Controller/releases/download/v2.6.0_beta/OpenRemote_Controller.zip

Uncompress the archive to your home folder

$ unzip OpenRemote_Controller.zip

Rename the folder (for consistency with upcoming tutorial steps)

$ mv OpenRemote-Controller openremote

Set the startup script to be executable

$ sudo chmod +x ./openremote/bin/openremote.sh

Sync Your Controller with Designer

$ cd /home/pi/openremote/bin
$ ./openremote.sh start

NOTE: Avoid starting openremote with sudo/root/admin privileges! Upon starting, OpenRemote will generate a number of files which will then be owned by root user instead of pi, leading to a number of error situations later on!

Open a browser, go to: http://[the IP address of your Raspberry Pi]:8688/controller/

Log in, sync your design.


Set OpenRemote to Run as a Service

This part of the guide enables OpenRemote to run as a service with start/stop/restart functionality. The provided script file is modified from the original contributed by Kal Ross.

$ sudo nano /etc/init.d/openremote

Paste the following script into the file:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          openremote
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

cd /home/pi/openremote/bin        # Modify this line to your OpenRemote Controller installation path

case "$1" in

stop)
        echo "Stopping OpenRemote Controller..."
        su pi /home/pi/openremote/bin/openremote.sh stop > /dev/null 2>&1 &
        ;;

start)
        # start OpenRemote in background mode
        su pi /home/pi/openremote/bin/openremote.sh start > /dev/null 2>&1 &
        echo "OpenRemote Controller started..."
        ;;

restart)
        $0 stop
        sleep 5
        $0 start
        ;;
*)
        echo "usage: $0 { start | stop | restart}" >&2
        exit 1
        ;;

esac

Then exit nano by pressing ctrl+x and approving the change. Please note that this script assumes your OpenRemote Controller is running in openremote folder in the default user's home folder /home/pi and if this has been changed, your installation may not run properly due to permission mismatches. The script also starts the service as the user pi, instead of root, to avoid permission issues.


The Final Step

If everything's all set up, your OpenRemote Controller should launch after a reboot and provide the synced designs to your clients. Let's try...

$ sudo reboot