Skip to content

kajilemon/integration-watson-iot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Things Network Example Integration with IBM Watson IoT Platform

This is an example integration of The Things Network with IBM Watson IoT Platform

Learn more about Watson Iot Platform

Setup

Make sure you have to configure your TTN Application as Watson IoT device.

  1. Login to Bluemix Console
  2. Check your organization for your account which is refered as "org".
  3. Login to Watson IoT dashboard
  4. Create device type (eg. ttn) which is refered as "type".
  5. Create device (eg. loraapp01) which is refered as "id".
  6. Create Application API key which is refered as "auth-token".

You need this parameters (org, type, id, auth-token) to connect to Watson Iot Platform.

Example

'use strict';

const ttnwatsoniot = require('../src');

// Replace with your AppEUI and App Access Key
const appEUI = '<insert AppEUI>';
const appAccessKey = '<insert App Access Key>';

// Replace with your Watson IoT config
var config = {
    "org" : "<insert Watson-IoT org value>",
    "type" : "<insert Watson-IoT type value>",
    "id" : "<insert Watson IoT id value>",
    "domain": "internetofthings.ibmcloud.com",
    "auth-method" : "token",
    "auth-token" : "<insert Watson Iot auth token>"
};

var options = {};
options.config = config;
options.qos = 2;

const bridge = new ttnwatsoniot.Bridge(appEUI, appAccessKey, options);

bridge.on('watsoniot-connect', () => {
  console.log('Watson IoT connected');
});

bridge.on('ttn-connect', () => {
  console.log('TTN connected');
});

bridge.on('error', err => {
  console.warn('Error', err);
});

bridge.on('uplink', e => {
  console.log('%s: Uplink', e.devEUI, e.message);
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published