M2X


Repository| Issues

A Cloud-Based Data Storage Service and Management Toolset Customized for the Internet of Things

For more info about the M2X platform click here.

How to Install

Install the module with:

$ npm install cylon cylon-m2x

How to Use

var Cylon = require("cylon");

Cylon.robot({
  connections: {
    m2x: { adaptor: "m2x", masterKey: "masterKey" }
  },

  devices: {
    m2xDevice: { driver: "m2x", id: "d9c3b48d3be2e..." }
  },

  work: function(my) {
    var baseTemp = 20, temp = 0;

    every(2000, function() {
      temp = Math.floor(Math.random() * 6) + 1 + baseTemp;
      my.m2xDevice.publish("temp", temp, function(err, data) {
        console.log("Err: ", err);
        console.log("Values: ", data);
      });
    });
  }
}).start();

How to Connect

On the M2X site, sign up for an account, or log into your existing account. After doing so, create a new Device. The name of the device and details don't matter that much, but they should be meaningful.

Create New Device

With that done, inside the new Device, create a new Stream. This will be the data repository you can push and read values from Cylon.

New Stream

Once that's done, you're good to go. Make sure to grab the Master API key from your account details page and Device ID from the devices page.

Now you're ready to hook up Cylon to M2X!

Drivers

Available drivers for the M2X platform are listed below.