Raspbian Jessie on Raspberry Pi Setup


On this page:

Introduction

This document will describe the Initial setup of Site Controller on an Raspbian Jessie installation. Raspbian is a standard OS for the Raspberry PI

Prerequisites

You will need to know the IP of the system and to have access via ssh.

Required installation files

  • SiteController installation archive (e.g. SiteController-install-1.3.6lsy.tar.gz):  SiteController modules and necessary python libraries 


SiteController is available through official purchase of a license or directly through azeti for development tests / integration tests. Upload the required files to the ubuntu server, e.g. in /root/download and proceed from there.

Configure the time zone

Timezone configuration

Before you begin the installation, make sure that you have the system with the right time configuration and a timezone configured in your system. Please read the file /etc/timezone to check that it is including your location. This file should contain a pair (Example: Europe/Berlin), that corresponds to the names that you can find in /usr/share/zoneinfo.

Core software installation

All the following commands must be done as root. You can add "sudo" to the beginning of all the commands or use "sudo su" in order to be root and continue with the instructions.


Once the system is installed, you will need to do a basic configuration of the system in order to connect to the cloud server. You should have received all the credentials beforehand, contact your provider in case you miss some information.

  1. Install prerequisites for compiling packages

    raspberrypi:/home/pi/SiteController-install# apt-get install python-dev
  2. Install mosquitto, create a mosquitto group and user.

    The default mosquitto package in the raspbian repositories is before version 1.0. You must add the special mosquitto.org repository to retrieve the latest debian package (version 1.4 or higher). The next step is a short version of the full instructions, taken from mosquitto.org, which you can find here.

    root@raspberrypi:~# wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
    root@raspberrypi:~# apt-key add mosquitto-repo.gpg.key
    root@raspberrypi:~# cd /etc/apt/sources.list.d/
    root@raspberrypi:~# wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
    root@raspberrypi:~# apt-get update
    root@raspberrypi:~# apt-get install mosquitto
    
  3. Install SiteController (output was truncated)

    raspberrypi:/home/pi/SiteController-install# ./setup.sh
    Checking Python version ... 2.7.9 
    OS type is raspbian
    Found default config in /home/pi/SiteController-install/config/SiteController.cfg
    Checking for meta config file ...
    Using config /home/pi/SiteController-install/config/SiteController.cfg
    Checking for previous installation of SiteController ...
    No previous installation found.
    Installing python libraries ...
    Checking python module setuptools, version 12.2 ... different version (5.5.1) installed. Installing supported version.
    Checking python module Crypto, version 2.6.1 ... not installed.
    Checking python module psutil, version 2.2.1 ... not installed.
    Checking python module pytz, version 2014.7 ... not installed.
    Checking python module bitstring, version 3.1.3 ... not installed.
    Checking python module pyasn1, version 0.1.7 ... not installed.
    Checking python module pysnmp, version 4.2.5 ... not installed.
    Checking python module pyxb, version 1.2.3 ... not installed.
    Checking python module serial, version 2.7 ... different version (2.6) installed. Installing supported version.
    Checking python module six, version 1.9.0 ... different version (1.8.0) installed. Installing supported version.
    Checking python module apscheduler, version 3.0.0 ... not installed.
    Checking python module paho.mqtt, version 1.1 ... not installed.
    Checking python module pyftpdlib, version 1.4.0 ... not installed.
    Checking python module pynmea2, version 1.5.3 ... not installed.
    Installing pycrypto-2.6.1.tar.gz ...
    Installing psutil-2.2.1.tar.gz ...
    Installing pytz-2014.7.tar.gz ...
    Installing bitstring-3.1.3.tar.gz ...
    Installing tzlocal-1.1.2.zip ...
    Installing futures-2.1.6.tar.gz ...
    Installing pyasn1-0.1.7.tar.gz ...
    Installing pysnmp-4.2.5.tar.gz ...
    Installing PyXB-1.2.3.tar.gz ...
    Installing modbus-tk-0.4.2.tar.gz ...
    Installing six-1.9.0.tar.gz ...
    Installing APScheduler-3.0.0.tar.gz ...
    Installing paho-mqtt-1.1.tar.gz ...
    Installing pyftpdlib-1.4.0.tar.gz ...
    Installing pynmea2-1.5.3.tar.gz ...
    Installing SiteController ...
    Creating config folder ...
    Creating log folder ...
    Creating tmp folder ...
    Creating persists folder ...
    Copying configuration ...
    Installing new source files ...
    Checking launcher sysmlink ...
    Running autostart script for host type Raspi
    Running update-rc.d for installing the start scripts
    Please provide a unique serial name for your SiteController!
    Allowed characters are upper and lower case ASCII [a-zA-Z],
    digits [0-9], dashes - and underlines _.
    Your entry: > Raspbian-Test
    Serial name set to Raspbian-Test
    Changing serial id of SiteController from "" to "Raspbian-Test".
    
    
    /opt/azeti/SiteController/config/SiteController.cfg has been modified.
    
    Hint: to start the SiteController directly after the installation
    		run the setup script with AUTOSTART_SITECONTROLLER set to 1:
    
    	AUTOSTART_SITECONTROLLER=1 ./setup.sh
    
    Please check the configurations in 
    "/opt/azeti/SiteController/config".
    Adapt them to your needs, then start the controller with
    the following line (copy the complete line, there are two
    quotes in it):
    
        "/opt/azeti/SiteController/run_SiteController.py" start
    
    
    

Starting the system

  1. Start the SiteController, it will start the mosquitto automatically if necessary 

    raspberrypi:~# /opt/azeti/SiteController/run_SiteController.py start

    Please stay 2 minutes in the terminal after the start of the site controller. If there is a problem in the system the modules will launch an exception. If no exception came in 2 minutes, the system is up and running with no issues.

  2. Once everything is started, you can use the following command to check that all modules are up and running:
    1. SiteController Status, note that required modules should be marked green and running

      raspberrypi:~# /opt/azeti/SiteController/run_SiteController.py status
      WARNING: section SiteController.conf not contained in SiteController.cfg.
      Time zone set to: Etc/UTC
      Serial of this installation: skoch-ubuntu01
      Main version of this installation: 1.1.0_(Build:1228_c300ebc)
      OK: Integrity check passed.
      OK: Module Watchdog.py is running with PID (21268)
      OK: Module cloudConnector.py is running with PID (21277)
      OK: Module HD2CloudExporter.py is running with PID (21284)
      OK: Module ConfigProvider.py is running with PID (21289)
      OK: Module RawResultsDeMux.py is running with PID (21296)
      OK: Module CalibResultsEvaluator.py is running with PID (21302)
      OK: Module JobProcessor.py is running with PID (21306)
      OK: Module AutomationController.py is running with PID (21310)
      OK: Module VirtualSensorProvider.py is running with PID (21316)
      OK: Module ModbusDaemon/ModbusMaster.py is running with PID (21322)
      OK: Module UDPserver_AdvantechAdam60xx.py is running with PID (21330)
      OK: Module trapd.py is running with PID (21334)
      OK: Module snmpgetd.py is running with PID (21339)
      OK: Module http_server.py is running with PID (21347)
      OK: Module persistord.py is running with PID (21354)
      WARNING: Module VS_fill_quantity.py is not running.
      WARNING: Module VS_flow_rate.py is not running.
      WARNING: Module VS_tank_simulator.py is not running.
      WARNING: Module VS_access_control.py is not running.
      WARNING: Module VS_battery_details.py is not running.
      WARNING: Module VS_HistoryAnalyser.py is not running.
      WARNING: Module VS_filesize.py is not running.
      OK: Module mosquitto daemon is running with PID (21265)
      root@ubuntu:~# 
  3. Once the system is up and running, and if no errors are appearing in your command line or in the logs, you can proceed to delete the installation compressed files and uncompressed folders to save space in the device.