How Can We Help?
< Back
You are here:

IoT Edge Gateway Software API V1


The Aretas IoT Edge Gateway Software ships with most Aretas sensor packages and is available through the Aretas Ubuntu PPA as a self-install. Many other documents are available in the knowledge-base to cover installing the software and edge device hardware.

The software offers several key features:

  1. Visualize Sensor Data in Real-Time
  2. Export sensor data to CSV
  3. Process and Send Sensor Data to the Cloud
  4. Backlog Sensor Data when Internet is unavailable
  5. Persist Sensor Data
  6. Complete separation of UI and API
  7. Autodiscovery via MDNS / Bonjour

Below is a screenshot of the basic software interface:

Radiation monitor data charting

If you are working with an Aretas supplied device or you have installed the Ubuntu package, you can use an AVAHI browser to locate the IP address of the device on your network. A KB Article can be found here describing the process:

*Note, you can typically access a test device at for interim development testing (API, etc).

Software Configuration

The software has several configuration files. The main configuration files are located in:


The main config file is bridge.ini 

The contents of a typical file look like this:







webserver.enabled=true =
webserver.port = 80
webserver.ui_path = /opt/aretas/Bridge/bridgewebinterface/

Explanation of Configuration Variables


The username is your username assigned to your account, for sending data to the Cloud API


The password is the password assigned to your account. You must provide a valid password if you have provided your username and wish to enable sending data to the Cloud API and receiving Strategies and Control .


This is a String containing the owner_id provided with your account. You must provide an owner id in addition to a username and password when accessing the cloud API to download strategies and control thresholds.


Default: /dev/ttyUSB0

This is the serial port of the XBee/ZigBEE adapter or UART (for embedded versions)


A valid system user that the software will run as. This will have been created by the .deb package install script in Ubuntu / Debian. If you are performing a custom installation, you may need to create this user manually.[String]

A valid system group the software will run as. This will have been created by the .deb package install script in Ubuntu / Debian. If you are performing a custom installation, you may need to create this user manually.


Set to true to enable logging. Set to false to disable logging. Logs are typically located in /var/log/aretas. Also check logging.conf for additional logging configuration variables.


Sets local mode. If local is set to true, no messages will be posted to the sensorapi.url (even if the sensors have been authorized in your account). If local is set to false, messages will be sent to the sensorapi.url using the standard GET method.



The URL used to post Sensor messages. You can change this URL to a custom end point as long as it follows the same GET / REST format as the Aretas API ingest endpoints.

Every time a valid sensor message is received by the gateway, the sensorapi.url is called with the sensor data, type, mac address of the sensor and a timestamp.



The URL used by the bridge to query for Control strategies. Control strategies are user defined thresholds for various sensor types and control messages for Thermostats, Demand Ventilation Controllers and other types of equipment. Requires a valid username, password and bridge.owner_id



The URL used to query the sensor semantics (label names, colors, codes, etc). Returns a JSON array of Objects. A small sample is below (there are roughly 100+ sensor types returned by the service):

[{"enabled":true,"display":true,"sensorColor":"0x00AA72","gasStatsSupported":false,"sensorGasFormula":"","label":"Control Switch","charCode":"CSW","charting":true,"type":"0x11"},{"enabled":true,"display":true,"sensorColor":"0x00AA72","gasStatsSupported":false,"sensorGasFormula":"","label":"Theta","charCode":"THETA","charting":true,"type":"0x15"}]

Requires a valid username, password and bridge.owner_id

A recent version of the sensortypes json is cached in the distribution and this setting is not entirely necessary, but is useful to stay up to date with the latest sensor semantic information.


Enables / disables the sensor service controller (the software thread / process that dispatches control messages to associated sensors). The service controller, when enabled, will only attempt to dispatch control messages to sensors that have reported within the service_controller.assoc_timeout_ms value. Requires a valid username, password and bridge.owner_id.


Default: 3600000

If the time (in milliseconds) between sensor reports exceeds this time interval, the Sensor will no longer be considered associated with this Edge device and will no longer received control messages.


Default: true

Enable / Disable the built in web / REST server. = [String/IP Address]


Select the IP address to bind to. Set to to listen on all interfaces.

webserver.port = [Number]

Default: 80

The port the web server will listen on. Default is 80, however, if you are self-installing on your own device with other services running, you may want to change the port to avoid conflicts.

webserver.ui_path = [String]

Default:  /opt/aretas/Bridge/bridgewebinterface/

The folder with the Web UI (html/javascript application). You can use the included application or using the API, write your own and change the webserver.ui_path setting to point to your custom application.[String/IP Address/Hostname]

Default: localhost

The Edge software requires access to a Redis database. The .deb package installs this dependency automatically, however if you are installing from source or would like to have a dedicated Redis instance, you can change this to an external host.


Default: 6379

The Redis service port. Don’t change this unless Redis is running on a non-standard port.


Default: 0

The Redis database for storing the raw serial input from the wireless adapter. Don’t change this unless you know what you’re doing.


Default: 1

The Redis database for storing service controller information. Don’t change this unless you know what you’re doing.


Default: 2

The Redis database for storing backlog sensor messages. Don’t change this unless you know what you’re doing.


Default: 3

The Redis database for storing sensor reports. Don’t change this unless you know what you’re doing.


Default: 4

The Redis database for storing sensor type information. Don’t change this unless you know what you’re doing.

Additional Serial Configuration File (for Go serial port reader)

If the main serial port changes for any reason, you may also need to edit /opt/aretas/Bridge/bridge_impl/bin/serial_reader.ini

Ensure this file also has the correct serial port and redis db.

Edge Device v1 REST API

The Edge Device software comes enabled with 2 basic web service endpoints you can use to build your own application.

Get Data Request: /data

Called to get initial chunk of data and /or to get updates



URL example

*hint, use to generate some timestamps to use to query the sample URI. Make sure you multiply by 1000 to convert to milliseconds (or just add 000)


from – timestamp with milliseconds – start time

to – timestamp with milliseconds – end time

mac – mac address of the device – (optional) if absent, returns data for all macs  reporting to the edge device

Return format


Return codes

200      Everything worked as expected

400      Bad Request – Often missing a required parameter

Return Data

{ "mac" : [{type, color, units, label, series[[timestamp, value],], {{type, color, units, label, series[[timestamp, value]], ],  }

Return Data Example

    "1082900827": [{
        "type": "248",
        "color": "0x3DA028",
        "units": null,
        "label": "Relative Humidity",
        "series": [
            [1467141098550, 57.97],
            [1467141218377, 57.83],
            [1467141339622, 57.77],
            [1467141459860, 57.67],
        "code": "RH"
    }, {
        "type": "80",
        "color": "0x25D500",
        "units": null,
        "label": "Nitrogen Dioxide",
        "series": [
            [1467141097543, 0.0],
            [1467141338615, 0.0],
            [1467141458853, 0.0],
            [1467141579091, 0.0],
            [1467141699329, 0.0],
            [1467141819566, 0.0],
        "code": "NO2"
    "1082900928": [],

Code Example

sg.updateDataByMac = function(){
var now = new Date().getTime();
var timeStart = now - sg.period;
  type: "GET",
  url: "http://""/data?from="+timeStart+ "&to="+now+"&mac="+sg.mac,
  contentType: "application/json",
  dataType: 'json',
  success: function(data){
    $.each(data[sg.mac], function( index, sensor ) {
      if (sensor.type == sg.type){
        var series = {}; = sensor.series;
        series.label = sensor.label;
        series.type = sensor.type;
        series.color = sensor.color.replace("0x", "#"); = [series];
Web Socket Request /ws

Subscribe to data updates.

Used to create a channel between a client and web server to deliver updates automatically using a web socket mechanism. 

Return Format


Return Data

{'mac': mac, 'type': type, 'timestamp': timestamp, 'data': data}

Return Data Example

{'mac': '1082900827', 'type': '248',  'timestamp': 1467141098550, 'data': 57.97}

Code Example

var ws = new WebSocket("ws://""/ws");
ws.onopen = function() {
  ws.send("Hello, world");
ws.onclose = function(){
  console.log('Connection closed');
ws.onerror = function(evt) { console.log(evt) };
ws.onmessage = function (evt) {
var point = JSON.parse(;
if (point["mac"]){
  var key = point["mac"]+point["type"].toString();
  var graph = graphs[key];
  if (graph != null){
    graph.addPoint(point.type, point);
Posting Data Via HTTP / GET to the Edge Device



Example URL



stype  – sensor type (0-255)

data – the sensor payload data

mac – mac address of the device – (optional) if absent, returns data for all macs  reporting to the edge device

Exporting CSV Data



Example URL


from – timestamp with milliseconds – start time

to – timestamp with milliseconds – end time

mac – mac address of the device 

Return Format



Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Table of Contents