The Octave Developer Hub

Welcome to the Octave developer hub. You'll find comprehensive guides and documentation to help you start working with Octave as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Edge Action Runner Reference

This topics provides detailed information about the Action Runner scripting language that you can use to implement logic in Edge Actions that run on Octave edge devices at the edge.

JavaScript Environment

The Action Runner runs the appropriate Actions when their configured triggers are received from the Data Hub.

ECMAScript 5

The environment that executes your code is in strict mode, a restricted subset of JavaScript 5.1. For more information, read the documentation.

With this version you should avoid declaring global variables (use var x = 1; instead of just simply x = 1;). For more information about strict mode, read the Mozilla Developer Network article.

We do not support most features of ECMAScript 6 and we also disallow the use of eval. If you are not familiar with JavaScript, get started in a few minutes with the following resources:



The Action is a standard ECMAScript 5.1 function, with arity-1:

function ( payload ) {

Valid input payload consists of any valid JSON element:

  • JSON Boolean
  • JSON Number
  • JSON String
  • JSON Object
  • JSON Array


Each Action should return a value. If no value is returned, no further work needs to be done. If a value is returned, Action Runner validates it to match the following JSON format:

result = {
     key1 : [ value1, value2, … , valueN],
     key2 : [ … ],
     keyN : [ … ]

Each value must be in an array of key/value pairs.

The “keys” specify the target to deliver the payloads. Each key is a URI, comprised of a scheme (), a separator (://), and a path () - i.e. ://. The available key types are:

NameFormat (<destination>://<path>)
Datahub Resourcedh://<resource_value_path>
Virtual Resourcevr://<virtual_resource_name>
Cloud (Immediate)cl://
Cloud (Store and Forward)st://

The “values” are the data to output. Each “value” can be any JSON type (boolean, number, string, object, array).



Events sent from an Edge Action cannot be sent to a named Stream in the Cloud, they will be stored in the :/default Stream of the device.

Each <destination>://<path> entry must be unique.

Errors and Failures

  • If an Action fails validation at compilation (load) time, it cannot be loaded. If it is the sole Action to specify that topic, Octave remove the callback handler for that topic.
  • If an Action fails while executing, an error should be logged, and a value should be written to the Data Hub.
  • If a single output “key” or “value” fails validation, Octave proceeds with the other keys and values and continue to process those which are valid.

Octave Functions

The following JavaScript functions are provided within the environment:

  • Performs a read operation on the Data Hub (e.g. to read the value of a resource).
  • Datahub.query(): Performs a query operation which reads the min, max, mean, or standard deviation of a value on the Data Hub.

The function accepts a path and a timeout parameter, and proxy to the following Data Hub API function:

data =, 0)


The path is checked to be a valid resource in the Data Hub and may one of two types:

  • Regular Resources:
  • Actual resources; must begin with a /.
  • These paths can be either absolute or relative. Absolute paths must begin with /app and are used without modification.
  • Relative paths are assumed to be with respect to /app and have /app prepended to them internally before use (e.g. The relative path argument: /myapp/mysensor/period is converted to the full path: /app/myapp/mysensor/period).
  • Virtual Resources: Virtual Resources are user-defined resources created from within an Action or from the Cloud via /virtual/config Resource. These are read using and are written using the vr:// output tag in the return object. Each Virtual resource behaves in a similar way to that of a global variable, and is accessible from all actions which belong to a particular device. These resources are not visible between devices.
  • Variable names which do not contain any slashes / (i.e. no sub-directories).
  • When read, the terminating node /value is appended to the path.


The timeout parameter has been deprecated and is always 0. Immediately upon being called, the read function will attempt to read from the resource.
The value read will be returned or NULL will be returned if the read failed.


The resulting data will be in JSON format, with two field names:

{ value : <data value>, timestamp : <seconds> }

For regular resources, <data name> is the terminating node of the path provided. For example:

var result ='/io/ADC0/period', 0)

Will return:

    "period" : 300,
    timestamp : 1292947293

For user-defined resources, the terminating node of the path is always "value". For example:

var result ="/redSensor/light/value",0);

Will return:

    "value" : 254,
    timestamp : 1234567890


The Datahub.query() function accepts a path, query-type, and window size (in seconds) parameters:

Datahub.query(path, query - type, window - size)


The path is validated to be a valid path in the Data Hub and may be either absolute or relative. Absolute paths must begin with /obs. Relative paths are assumed to be with respect to /obs and must begin with a /.


The query type is a (case-insensitive) string matching one of: min, max, mean, or stddev.

The time window, in seconds, is the time from which to begin analyzing the data.


The resulting data will be a scalar. For example:

var queryResult = Datahub.query('my_observation', 'mean', 10000)

Will return a scalar:

Manipulating Binary Data

Often times it necessary to manipulate data such as that read from Modbus (e.g., to change endianness). This is can be done in an Edge Action or, less commonly, in a Cloud Action, using JavaScript's support for bitwise operators.

For more information about bitwise operator support in JavaScript, see: Bitwise Operators.

Updated 7 days ago

Edge Action Runner Reference

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.