IDE OM2M

Node-RED for OM2M: node-red-contrib-ide-iot

IDE-OM2M: a framework for developing IoT applications using the OM2M platform

(https://www.npmjs.com/package/node-red-contrib-ide-iot)

This page gives examples and tutorial to use the Node-RED nodes for OM2M. Those nodes have been developed in a cooperation between LAAS-CNRS (France) and National Chiao Tung University (Taiwan). 

LAAS-CNRS Team:

NCTU team:

Node-RED is a programming tool for wiring hardware devices, APIs and online services in new and interesting way. It provides a browser-based editor that makes it easy to wire together flows using a wide range of nodes, available in the palette that can be deployed to its runtime in a single-click.

 

Contents:

  1. A) Installation
  2. B) Node-RED
  3. C) Integration of node-red-contrib-ide-iot
  4. D) Nodes

Platform, NamedSensor, LabeledSensor, SemanticSensor, DataExtractor, NotificationHandler, SimpleCondition, NamedActuator, LabeledActuator, SementicActuator

  1. E) Use Case 1
  2. F) Use Case 2

Nodes: Application, Container, ContentInstance, NotificationHandler

  1. A) Installation

Before installing Node-RED, you must have a working installation of Node.js. We recommend you to use the version LTS 8.x of Node.js available at this address: https://nodejs.org/en/download/.

Once the installation of Node.js has finished, we will proceed with the installation of Node-RED. The easiest way is to use the node package manager ‘npm’ that comes with Node.js as follows:

npm install -g –unsafe-perm node-red

PS: To use it as a global module, add the command node-red to your system path. After the installation of Node-RED, you can run it using the command:

node-red

Now, you can access to the Node-RED editor by pointing your browser at the address: http://localhost:1880 .

  1. B) Node-RED

Node-RED provides a feed editor that consists of basically three panels:

 

  1. Node Panel: Contains a list of nodes that will be used by the user to create their streams. Each node belongs to a specific category according to the functionality it offers.
  2. Flow Panel: This is the main workspace of the user, where he can create his streams by dragging and dropping nodes from the Node Panel.
  3. Information and Debug Panel: It consists of two tabs:
  • An info tab: which has for role the display the information relating to a given node (for example: its type, its properties, the functionalities it provides, etc.).
  • A debug tab: which allows the users to view the results and outputs of deployed flows and errors encountered during execution.

To create an application streams, the user slips the desired node from the node palette and places it into the workspace. Once he has done with all the required nodes, he has to connect them with arcs to constitute the application.

  1. C) Integration of node-red-contrib-ide-iot in Node-RED
  2. Get and download the module node-red-contrib-ide-iot, then integrate it in Node-RED by using the npm link command. This allows you to link it into a local node-red install. In the directory containing the node’s package.json file, and run:

sudo npm link

In your node-red user directory, typically ~/.node-red, run the following command:

npm link node-red-contrib-ide-iot

This will create the appropriate symbolic links between the two directories, so Node-RED will discover the node at start-time. Any changes in the node’s file can be picked up by simplyrestarting Node-RED.

  1. As node-red-contrib-ide-iot is published in npm, we can directly use the following command to integrate it into Node-RED:

npm install node-red-contrib-ide-iot

We show the role and the functioning of the different nodes constituting IDE-OM2M via the manipulation of the simple examples:

To reproduce these examples, select the JSON given for each, right-mouse Copy and then Import from… clipboard in Node-RED and ctrl-V the content into the text box. Click OK and the three- node flow will appear under the cursor to be parked on the worksheet.

  1. D) Nodes
  2. E) Use Case 1
  3. F) Use case 2

Create a simple AE by using Application, Container, ContentInstance, Subscription, and NotificationHandler nodes.

Application:

 

Creates an Application resource. You can specify the following attributes:

  • Platform: Destination CSE.
  • Application: AE Id (application name).
  • Point of Access: PoA URL.
  • Announce: whether this resource is announced to other CSE or not.
  • Labels: labels to describe this application.

Container:

Creates a Container resource to store content instances. You can specify the following attributes:

  • Platform: Destination CSE.
  • Application: AE Id (application name).
  • Container: Name of the container (choose among DESCRIPTOR, DATA, or input your own container’s name).

 

ContentInstance:

Creates a ContentInstance resource to store application’s data. You can specify the following attributes:

  • Platform: Destination CSE.
  • Application: AE Id (application name).
  • Container: Name of the container.
  • Labels: The data you want to store. You must describe three fields: Type (str, int, bool, etc.), Name (the name of the attribute), Value (the value of the attribute).

Subscription:

Creates a Subscription source. You can specify the following attributes:

  • Platform: Destination CSE.
  • Application: AE Id (application name).
  • Container: Name of the container you want to subscribe to.
  • Path: URL of the webservice that will handle the notification of this subscription.

NotificationHandler:

Creates a HTTP werbservice able to manage platform notifications. You can specify the following attributes:

  • Host: Host IP address.
  • Port: Host Port number.
  • Context: context path of the webservice.

 

Notification received: