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

Reading Event Data in an Edge Action

When writing the code for an Edge Action, you will usually base your logic around the value from the incoming Event being Observed such as the value of a sensor reading.

When an Event is received in an Edge Action, the event parameter contains the Event's data:

function(event) {

}

The Event is received as a JSON object on the Octave Edge device and contains the following fields:

{
  "value": value,
  "timestamp": 1582827837.235676
}
  • value: the Event's data (e.g., a sensor reading).
  • timestamp: The date/time when the event was received.

The JavaScript in an Edge Action can read this information via the event parameter. For example, the following code reads the value of a light sensor:

function(event) {
  var lightReading = event.value;
  // ...
}

After reading the Event's value, you may then want to perform some logic and then set a value. For additional information see the Edge Action Runner Reference.

Updated 10 months ago


Reading Event Data in an Edge Action


Suggested Edits are limited on API Reference Pages

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