Creating a Cloud Action

The following steps demonstrate how to create a Cloud Action to process Events received from a Cloud Stream. In this example, the Cloud Action will simply output some text received in an Event to the LCD screen on a device:

  1. To create the Cloud action, navigate to Build > Cloud > Actions.
  2. Click Add Cloud Action.
  3. Set Source stream or tag to Stream (1) for this example. This will use the data values from a Stream in Octave. If the field is set to Tag, the data values will come from the tagged device's Stream (a Device stream field will appear, allowing you to select the stream):
  1. Ensure the Enabled checkbox (2) is enabled.
  2. (Optional) Rename the Cloud Action by clicking on the edit icon (3) beside cloud name:

Enter a name (4) and click Set (5):

  1. Enter your JavaScript code (6) that is to execute in the cloud on the event data.

For example, the following implementation sets the LCD value on the LCD screen included with the Octave Edge Devices. This code updates line 1 of the LCD with a message in case the light is above an arbitrary threshold of 1500. Note how the device and company IDs are extracted from the incoming event and used to dynamically construct the full path to the command stream on which to set the LCD text through:

function(event) {
  var output = {};
  var deviceId = event.path.split("/")[3];
  var companyId = event.path.split("/")[1];
  var command_path = "/" + companyId.toLowerCase() + "/devices/" + deviceId.toLowerCase() + "/:command";

  var light_reading = event.elems.redSensor.light;

  if (light_reading > 1500) {
    output[command_path] = [{
      "elems": {
        "lcd": {
          "txt1": "too Much Light!"
  return output;
  1. Click on Save (7) to save the Cloud Action.