Cylon.js For Intel Iot Analytics
Cylon.js (http://cylonjs.com) is a JavaScript framework for robotics, physical computing, and the Internet of Things using Node.js
This repository contains the Cylon adaptor for Intel's Iot Analytics platform.
For more information about Cylon, check out the repo at https://github.com/hybridgroup/cylon
Want to use Ruby on robots? Check out our sister project Artoo (http://artoo.io)
Want to use the Go programming language to power your robots? Check out our sister project Gobot (http://gobot.io).
How to Install
Install the module with:
$ npm install cylon cylon-intel-iot-analytics
How to Use
"use strict"; var Cylon = ; Cylonstart;
How to Connect
On the Intel IoT Analytics site, sign up for an account, or log into your existing account. After doing so, you can create a new Device using the developer portal or using Cylon.js.
If you do it using Cylon, you'll need the accountId
and your username and password. You can get the account id from the
accounts section in the developer portal.
Once you have the accountId
you can create new devices for that account using Cylon as follows.
"use strict"; var Cylon = ; Cylonstart;
The name of the device and details don't matter that much, but they should be meaningful. You can also add devices using the Intel IoT Developer portal.
After a device is created we need to activate it in order to use it. This is a very crucial moment,
since after activation it is the ONLY time you can get the deviceToken
. If you lose it, you WILL NOT
be able to retrieve it or see it later ever again. This includes both with code using the API or within the dev portal itself.
By consequence, you will not be able to add components (needed to store data in a device),
or submit any data to the device, once you have already added components to it.
In order to activate a device you'll need an activationCode
. We can get this from the accounts
screen (check previous screenshoots), or you can get it using Cylon.js itself. In the following example we get the
activation code and activate a device in the same program:
"use strict"; var Cylon = ; Cylonstart;
Make sure to review and store the returned deviceToken
since as previously mentioned, we will
need it to add components and submit data.
Now that we have the device's deviceToken
and the device has been activated, we need to add a component
to it. This component will act as our data repository for that device in that account. In this example, we will do it with one of the default components already created and provided in the developer portal. However, you can create and customize your own from the portal or using Cylon.
Let's check the code:
"use strict"; var Cylon = ; Cylonstart;
Once that's done, we are ready to start submitting data to the device. Remember there are two
steps addComponent
and submitData
, that require the deviceToken
which is different than
the user authorizationToken
that is used for all other Intel IoT Analytics API calls. The deviceToken
is nly ever creating once for a device, and the authorizationToken
is generated each time you connect to Intel's IoT Analytics network.
This is how you submit data to a device:
"use strict"; var Cylon = ; Cylonstart;
In the same way, you can retrieve data from a device component:
"use strict"; var Cylon = ; Cylonstart;
That's it! With that, you should be able to create devices and components, add components to a device, and submit/retrieve data from a device component.
Now you're ready to hook up Cylon.JS to the Intel IoT Analytics network!
Documentation
We're busy adding documentation to cylonjs.com. Please check there as we continue to work on Cylon.js.
Thank you!
Contributing
For our contribution guidelines, please go to https://github.com/hybridgroup/cylon/blob/master/CONTRIBUTING.md.
Release History
For the release history, please go to https://github.com/hybridgroup/cylon-intel-iot-analytics/blob/master/RELEASES.md.
License
Copyright (c) 2015 The Hybrid Group. Licensed under the Apache 2.0 license.