iotkit-client
Edge client for IoT Kit Cloud
Client
Iot Kit Client is a node module that can easily be embedded in another Node.js application or run on its own.
Install
npm install iotkit-client
Configuration
- Rename
config-sample.json
toconfig.json
- Enter your IoT Kit
api_access_key
- Define
provider
of your choice (see Provider Configuration for details)
Start
./start.sh
Stop
./stop.sh
Device Id
Each device connecting to the IoT Kit Cloud, must provide globally unique device id. The IoT Kit Client has a way of defining deriving such id itself, or using one manually entered into the config.json
file.
Set Device Id Manually
Enter your preferred device Id into cloud.options.clientId
in the config.json
file.
Remember, this Id must be globally unique
Dynamically derived Id
If the cloud.options.clientId
value in the config.json
file is not set, or set to null
, the IoT Kit Client will derive the id dynamically. To find out what that Id is for your device simply run this command on the deice:
node device
The returned Id is derived from the network MAC address and should be constant in your current hardware configuration. Remember, if you change from WiFi to Ethernet for example, that Id will change.
Providers
The IoT Client implements provider pattern where the hardware specific code can be easily swappable depending on the necessary functionality and the underlining hardware. By default, the IoT Kit comes with the following providers:
- Intel® Galileo (under development)
- Ninja Block Sensors
- OS-level Sensors (default)
Ninja Block
To use IoT Kit Client with Ninja Blocks, simply follow the above instructions, but, before starting the client follow these simple steps:
Install Dependancies
npm install ninja-blocks
Configure User Access Token
In config.json
in the root of the client, define the provider.src
to ./provider/ninja/ninja-provider.js
and in the args
portion of the provider enter your user_access_token
. You can find your user_access_token
at the settings page of Ninja Cloud.