Hi there,
Playing with Octave since the general availability in October, many of us did come up with a numerous of sample apps that I’m suggesting the share here, in Octave forum.
Here’s a very simple first app, “box opening alarm” using a mangOH Yellow in a dark box and its light sensor to detect whenever the box is opened. Upon box opening detection, the light level is detected ubove some threshold and the app sends light values to the cloud and turns the buzzer ON on mangOH Yellow.
Feel free to try it and comment below!
Prerequisites
Before starting, make sure you already followed the getting started with mangOH Yellow and Octave: https://mangoh.io/mangoh-yellow-resources-getting-started
Octave concepts used
In this application, I’m using the following Octave components:
-
1 Resource (cf. Octave documentation: https://docs.octave.dev/references/edge/concepts/resources/)
light
-
2 Observations (cf. Octave documentation: https://docs.octave.dev/references/edge/concepts/observations/)
-
light_alarm
(send to an Edge action): sends events toLight Alarm
edge action -
light_to_cloud
(send to Cloud): sends light value to cloud when the value is above a threashold
-
-
1 Edge Action (cf. Octave documentation: https://docs.octave.dev/references/edge/concepts/edge_actions/)
-
Light Alarm
: switch on buzzer depending on a light threshold
-
Implementation
1. Resources
Enable the light resource:
-
light/enable
: true
2. Observations
3. Edge Actions
function(event) {
// Reads a value from the light sensor right away
var light = Datahub.read("/light/value", 0);
light = light ? light.value : 0;
// Is light above the detection threshold?
var alarm = light > 1.0;
return {
"dh://buzzer/enable": [alarm],
"dh://buzzer/percent": [60],
"dh://buzzer/period": [1]
}
}
Make sure to enable your edge action, and check the Streams for light values while the mangOH Yellow buzzer is ON. You can now tune your threshold value in the edge action and the light_to_cloud
observation.
Does this simple app run well for you? Let me know in the comments! Enhancements proposals are welcome too!
Feel free to share your own app in a new topic! (please mention what device your Octave app is using (mangOH Red, mangOH Yellow, FX30, etc…)