Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calderonroberto/7b8b276740de25c73f97 to your computer and use it in GitHub Desktop.
Save calderonroberto/7b8b276740de25c73f97 to your computer and use it in GitHub Desktop.
Example using the stsplatform module using callbacks.
sts = require('../stsplatform');
// Create a Client.
var client = new sts.Client();
// Create a sensor object, referencing the client/
var sensor = new sts.Sensors(client, 'calderonroberto.demo');
// Get the sensor information (print the response code)
sensor.get(null, function(error,response){
console.log(">>> Sensor Info");
console.log(response.data);
console.log(response.code);
});
// Create a Data object using a sensor
var data = new sts.Data(sensor);
// Print some data (last element)
// http://wotkit.readthedocs.org/en/latest/api_v1/api_sensor_data.html#raw-data-retrieval
data.get({beforeE:1}, function(error, response){
console.log(">>> Data");
console.log(response.data);
console.log(response.code);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment