Working with Resources
Resources are the heart of Octave edge devices. The Resources of a device define its services, sensors, and actuators that make up a solution, and are organized as a tree (hierarchy) on a device, similar to that of a file system on your computer. A device's Resources are viewed and managed via the Build > Device > Resource screen in Octave.
For additional information, see the Resources reference guide.
More generally, Resources represent entities that create, receive, or store Events (e.g., a physical input or output pin on an Octave edge device). A Resource is created by Octave after you have configured an entity (e.g., a GPIO output pin pin).
The following video provides an overview of Resources and how to work with them:
Since Resources are organized into a tree hierarchy, each Resource will have a path that identifies its location. For example, a sensor defined as a resource, might be represented as
/redSensor/light, an actuator defined by the LCD driver might be called
/lcd/txt, and the configuration for a GPIO service might be defined in
Resources for built-in features (e.g., onboard light sensors) are predefined in Octave, while Resources for other configurable features (e.g., GPIO pins) are only available after that underlying feature/service (e.g., a GPIO pin) is configured.
Your device will initially broadcast its Resource tree, such that it is available to view and manage in the Octave dashboard as well as through the Device object in the Octave REST API.
All Resources either input or output values, and are stateful (i.e., they hold the last single value sent to them). Inputs are tied to Input Resources and Sensor Resources and generate new events from the underlying application or hardware (e.g., the temperature data from a temperature sensor). Outputs (actuators) forward Events to the application or an asset (e.g., to move a robotic arm).
Inputs move data from the application to the Data Hub and Outputs move data from the Data Hub to the application. However, the direction is not strictly enforced and is used primarily to advertise the expected direction of flow. Applications may read/subscribe to Inputs if they want to and they may also write values to Outputs.
Each Resource is of a particular data type which can be a trigger, boolean, numeric, string, or JSON. Values of the wrong type are sometimes coerced to the right type. For example, if you send any non-zero number to a boolean type, it will be coerced to
For additional information see the Resources reference guide.
Before a Resource such as light sensor can be used, you must first configure its
period (sub) Resources (see Additional Resources for more information about sub Resources). To do so, you must push a new event to the Resource, either immediately or every time the device powers on. The latter is the preferred approach, and involves adding values to the
state attribute of the Octave edge device's Device Object.
Any updates to the Resource's configuration, Observations or Edge Actions, will be sent to the device when it next connects to the cellular network. The updated configuration will then persist locally on the device such that the configuration will survive device restarts.
Working with Specific Resource Types
The following subtopics provide tutorials on how to work with Resources:
- Managing Resources via the Octave Dashboard: how to manually work with Resources in Octave's user interface.
- Output (Actuator) Resources: set up a Resource for an output pin (e.g., GPIO Pin to emit voltage.
- Input Resources: set up a Resource for an input pin (e.g., GPIO Pin, that can receive data pushed by an asset to the Octave edge device at an arbitrary time and frequency.
- Sensor Resources: set up a Resource for a sensor which is an entity that gathers data about some physical phenomenon (e.g., light, temperature, etc.) and converts that data into analog or digital signals.
- Virtual Resources: set up and work with user-defined Resources not associated with a physical entity.
- Utilitary Resources: work with Resources which control and monitor several edge system-level processes.
Updated over 2 years ago