Difference between revisions of "IoTGateway/Node-Red"

From ESS-WIKI
Jump to: navigation, search
(wsn-senhub node section)
(fix typo)
Line 15: Line 15:
  
 
==Node-RED for WSN==
 
==Node-RED for WSN==
Wireless Sensor Network(WSN) is supported on Advantech WISE-3310 and all provided features are basically described by REST API respectively.  
+
Wireless Sensor Network (WSN) is supported on Advantech IoT Gateway and all provided features are basically described by REST API respectively.  
For users to quickly access the WSN features and build the prototype control logic flow of application before knowing the detailed REST API manipulation and programming, We provide the following Node-Red nodes to easily read the information and access functions of WSN on Advantech WISE-3310.
+
For users to quickly access the WSN features and build the prototype control flow of application before knowing the detailed REST API manipulation and programming, we provide the following Node-RED nodes to easily read the information and access functions of WSN on Advantech IoT Gateway.
 
*wsn-gw
 
*wsn-gw
 
*wsn-senhub
 
*wsn-senhub
Line 22: Line 22:
 
===Usage===
 
===Usage===
 
# In the browser, enter Advantech IoT Gateway's IP address with Node-RED port 1880 to open Node-RED web page.
 
# In the browser, enter Advantech IoT Gateway's IP address with Node-RED port 1880 to open Node-RED web page.
# On the left of the page, scroll down to find wsn-related nodes in Advantech section as depicted below.
+
# On the left of the page, scroll down to find '''wsn-'''related nodes in Advantech section as depicted below.
 
# Drag and drop wsn-related nodes into '''Sheet''' to start building control flow.
 
# Drag and drop wsn-related nodes into '''Sheet''' to start building control flow.
  
Line 29: Line 29:
  
 
==wsn-gw Node==
 
==wsn-gw Node==
Node to get the information and set functions of a ADVANTECH WSN gateway platform, triggered by an input message.
+
Node to get the information and set functions of a Advantech WSN gateway platform, triggered by an input message.
 
Outputs a msg with msg.payload containing the JSON description of reading or result.
 
Outputs a msg with msg.payload containing the JSON description of reading or result.
 
During configuration, it will automatically detect available options for Network, Category, and Attribute in real time.
 
During configuration, it will automatically detect available options for Network, Category, and Attribute in real time.
Line 52: Line 52:
 
* '''Category''' : Class of Attributes
 
* '''Category''' : Class of Attributes
 
* '''Attribute''' : List of Attributes in selected ''Category'' above
 
* '''Attribute''' : List of Attributes in selected ''Category'' above
* '''Set to''' : Place for entering value when operation is Set
+
* '''Set to''' : Place for entering value when Operation is '''Set'''
 
* '''Name''' : (optional) Place for entering the name of this node
 
* '''Name''' : (optional) Place for entering the name of this node
  
Line 86: Line 86:
  
  
5. The output in the debug window is a '''JSON''' string describing the result
+
5. The output in the debug window is a '''JSON''' format string describing the result
 
  {  
 
  {  
 
     "StatusCode": 200,  
 
     "StatusCode": 200,  
Line 98: Line 98:
  
 
==wsn-senhub Node==
 
==wsn-senhub Node==
Node to get the information and set functions of a SensorHub on ADVANTECH WSN gateway platform, triggered by an input message.
+
Node to get the information and set functions of a remote SensorHub (ex. WISE-1020) controlled by Advantech WSN gateway platform, triggered by an input message.
 
Outputs a msg with msg.payload containing the JSON description of reading or result.
 
Outputs a msg with msg.payload containing the JSON description of reading or result.
 
During configuration, it will automatically detect available options for Network, on-line sensorhub, and Attribute in real time.
 
During configuration, it will automatically detect available options for Network, on-line sensorhub, and Attribute in real time.
Line 121: Line 121:
 
* '''Category''' : Class of Attributes
 
* '''Category''' : Class of Attributes
 
* '''Attribute''' : List of Attributes in selected ''Category'' above
 
* '''Attribute''' : List of Attributes in selected ''Category'' above
* '''Set to''' : Place for entering value when operation is Set
+
* '''Set to''' : Place for entering value when Operation is '''Set'''
 
* '''Name''' : (optional) Place for entering the name of this node
 
* '''Name''' : (optional) Place for entering the name of this node
  
Line 130: Line 130:
 
1. Build a flow using '''inject''' as input node to '''wsn-senhub''' node, and '''debug''' as output node.
 
1. Build a flow using '''inject''' as input node to '''wsn-senhub''' node, and '''debug''' as output node.
  
2. Double click on wsn-gw node to open '''Edit wsn-gw node''' window and configure the node as below
+
2. Double click on wsn-senhub node to open '''Edit wsn-senhub node''' window and configure the node as below
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 137: Line 137:
 
| Operation || Get
 
| Operation || Get
 
|-
 
|-
| Network || WSN/WSN0/(your Interface MAC)
+
| Network || WSN/WSN0(your Interface MAC)
 
|-
 
|-
| Sensor ID || (your CO2 sensorhub MAC)
+
| Sensor ID || your CO2 sensorhub MAC
 
|-
 
|-
 
| Category || SenData
 
| Category || SenData
Line 155: Line 155:
  
  
5. The output in the debug window is a '''JSON''' string describing the result
+
5. The output in the debug window is a '''JSON''' format string describing the result
 
  {  
 
  {  
 
     "StatusCode": 200,  
 
     "StatusCode": 200,  

Revision as of 06:30, 10 March 2016

Advantech implements some Node-RED nodes for better development experience.

Node-RED for Alljoyn

We plan to provide three kinds of Node-RED nodes for Alljoyn feature.

  • Action Handler
  • Event Reader & Rule Engine
  • ControlPanel Client

Installation

You can install the node-red-contrib-alljoyn via NPM, or download it on GitHub.

Usage

Please refer to README.


Node-RED for WSN

Wireless Sensor Network (WSN) is supported on Advantech IoT Gateway and all provided features are basically described by REST API respectively. For users to quickly access the WSN features and build the prototype control flow of application before knowing the detailed REST API manipulation and programming, we provide the following Node-RED nodes to easily read the information and access functions of WSN on Advantech IoT Gateway.

  • wsn-gw
  • wsn-senhub

Usage

  1. In the browser, enter Advantech IoT Gateway's IP address with Node-RED port 1880 to open Node-RED web page.
  2. On the left of the page, scroll down to find wsn-related nodes in Advantech section as depicted below.
  3. Drag and drop wsn-related nodes into Sheet to start building control flow.

Open nodered.jpg


wsn-gw Node

Node to get the information and set functions of a Advantech WSN gateway platform, triggered by an input message. Outputs a msg with msg.payload containing the JSON description of reading or result. During configuration, it will automatically detect available options for Network, Category, and Attribute in real time.

Configuration

  • Drag and drop wsn-gw node into Sheet
  • Double click on the node to open Edit wsn-gw Node window for configuration as below
  • Start from the top item in the window, it will automatically detect and list the available options currently.

Edit wsn-gw.png

Items in Edit Window

  • Operation : Get or Set
  • Net Type : Supported network types on the platform
  • Net ID : List of available network interfaces of selected Net Type above. Options are listed in the format of :
Interface Name(Interface MAC)
ex. WSN0(00170d0000010203)
  • Category : Class of Attributes
  • Attribute : List of Attributes in selected Category above
  • Set to : Place for entering value when Operation is Set
  • Name : (optional) Place for entering the name of this node


Example: Get SensorHub List

This example shows how to build a control flow to get a list of sensorhub MAC address on selected network interface.

1. Build a flow using inject as input node to wsn-gw node, and debug as output node.

2. Double click on wsn-gw node to open Edit wsn-gw node window and configure the node as below

Item Value
Operation Get
Net Type WSN
Net ID WSN0(your Interface MAC)
Category Info
Attribute SenHubList

3. Connect nodes together and click on Deploy

Wsn-gw get senhublist.png


4. Click on the input node and you will see the result in debug window

Wsn-gw get senhublist result.png


5. The output in the debug window is a JSON format string describing the result

{ 
    "StatusCode": 200, 
    "Result": { 
        "n": "SenHubList", 
        "sv": "00170d0000603a0e,00170d0000602e5a,00170d0000304ab4,00170d000060339c", 
        "asm":	"r" 
    } 
}


wsn-senhub Node

Node to get the information and set functions of a remote SensorHub (ex. WISE-1020) controlled by Advantech WSN gateway platform, triggered by an input message. Outputs a msg with msg.payload containing the JSON description of reading or result. During configuration, it will automatically detect available options for Network, on-line sensorhub, and Attribute in real time.

Configuration

  • Drag and drop wsn-senhub node into Sheet
  • Double click on the node to open Edit wsn-senhub Node window for configuration as below
  • Start from the top item in the window, it will automatically detect and list the available options currently.

Edit wsn-senhub.png

Items in Edit Window

  • Operation : Get or Set
  • NetWork : List of available network interfaces. Options are listed in the format of :
Network Type/Interface Name(Interface MAC)
ex. WSN/WSN0(00170d0000010203)
  • Sensor ID : List of available SensorHub MAC address on network interface selected above.
  • Category : Class of Attributes
  • Attribute : List of Attributes in selected Category above
  • Set to : Place for entering value when Operation is Set
  • Name : (optional) Place for entering the name of this node


Example: Get CO2 Reading

This example shows how to build a control flow to get CO2 sensor reading on selected sensorhub.

1. Build a flow using inject as input node to wsn-senhub node, and debug as output node.

2. Double click on wsn-senhub node to open Edit wsn-senhub node window and configure the node as below

Item Value
Operation Get
Network WSN/WSN0(your Interface MAC)
Sensor ID your CO2 sensorhub MAC
Category SenData
Attribute CO2

3. Connect nodes together and click on Deploy

Wsn-senhub get co2.png


4. Click on the input node and you will see the result in debug window

Wsn-senhub get co2 result.png


5. The output in the debug window is a JSON format string describing the result

{ 
    "StatusCode": 200, 
    "Result": { 
        "n":	"CO2", 
        "u":	"ppm", 
        "v":	722, 
        "min":	400, 
        "max": 2000, 
        "asm":	"r", 
        "type": "d", 
        "rt": "ucum.ppm", 
        "st":	"ipso", 
        "exten": "" 
    } 
}


WSN Control Logic Flow Example

Combine WSN with Freeboard