mym2m-client
v0.0.4
Published
Node SDK for the MyM2M Web JSON Device API
Downloads
2
Readme
360 Telemetry MyM2M Web Node.js Client
This is the Node.js client for the 360 Telemetry MyM2M Web Platform.
Caveats
- Configuration exchange is currently unsupported in either direction (from the device to the MyM2M Service or vice-versa).
Getting Started
You can use the client within an existing project by installing it using npm:
npm install mym2m --save
Example Usage
var mym2m = require('mym2m-client');
// create a new API client with your device key and unit identifier
var myDevice = new mym2m.API('YOUR-DEVICE-KEY', 'UNIT00001');
// create a snapshot with some sample data
var snapshot = new mym2m.Snapshot();
snapshot.setChannel('temp', 25);
snapshot.setChannel('humid', 40);
// add the snapshot
myDevice.add(snapshot);
// dispatch!
myDevice.dispatch()
.catch(function(result) {
console.log(result);
console.error('Dispatch failed. You can inspect result.response and result.error to debug.');
});