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

Report multiple Resources in a single Event and Stream

In the previous examples, data from each Resource was routed to a different Cloud Stream.
Depending on how you plan to handle the data on the cloud side, it can be beneficial to send most of your data in a single stream.

This is how to do so:

Key Takeways

  • in order to send Resource data in a single Event, you can use an Edge Action to collect the data and create the Event with the resource payload that you want
  • one resource and EA Observation is used to trigger the EA
  • other Resources can be ready from the EA:
    • directly via a Datahub.Read('resource') to get the latest value of a Resource
    • by calling an Observation via Datahub.query('observation'), thus benefiting from the Observation characteristics (filter, buffering, min/max/mean)
  • the Event sent from the EA will be routed to the 'device/:default' stream

Here's a short example of an EA code handling this implementation:

function(event) {

return {
  "cl://": [{																								
    "temperature":  event.value,														
    "humidity":     Datahub.read('/humidity/value',0).value,
    "wind_speed":   Datahub.query('wind_speed','mean',10)
    }]
};

}

and this is what the Event looks like in the 'device/:default' stream:

{
 "elems": {
    "humidity": 31.3,
    "temperature": 37.4,
    "wind_speed": 17.7
  }
}

Learning more:

  • in order to report Events on a periodic basis rather than on an actual measurable Resource, a similar approach can be taken with 'util/counter/value' as the input Resource to trigger the EA
  • by directing the EA output to "sf://" instead of "cl://" the Events will be handled by the S&F and sent according to its flulshing rules.
  • if you want to use a similar approach but send the data to another stream than 'device/:default', you can write rout EA output to a JSON VR and set a CS Observation on that VR

Updated 12 days ago

Report multiple Resources in a single Event and Stream


Suggested Edits are limited on API Reference Pages

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