Advantech WISE-PaaS 2.0 Node-RED Plug-ins User Manual
Introduction
Node-RED is a visual wiring tool for the Internet of Things, provided by IBM Emerging Technologies. Node-RED features browser-based flow editing, built on Node.js, and supports social development. Its browser-based nature makes it user-friendly. Node-RED is based on Node.js, allowing users to utilize its nodes with JavaScript. It also boasts many active communities, enabling users to find solutions and fix bugs easily. Users can import or export created flows using JSON format strings.
In accordance with the restful API of WISE-PaaS 2.0, several nodes have been created. These nodes facilitate interaction with the WISE-PaaS 2.0 platform.
The Node-RED flow diagram illustrates a typical setup: a 'timestamp' node initiates a process, feeding into a 'ServerConfig' node. The 'ServerConfig' node then connects to various data retrieval nodes such as 'DevicesQuery', 'PluginsQuery', 'SensorsQuery', and 'DataQuery'. These connections are often marked with status indicators like 'done' or 'sending', ultimately processing data into 'msg.payload'.
How to install Node-Red Plug-ins for WISE-PaaS
Install Node.js
- Download the installer from https://nodejs.org.
- Double-click the downloaded file to install Node.js.
The Node.js setup wizard guides the user through the installation process. Key steps include: accepting the End-User License Agreement, choosing a destination folder (defaulting to C:\Program Files\nodejs\), selecting custom setup options (including the Node.js runtime, npm package manager, online documentation shortcuts, and adding to PATH), and finally proceeding with the installation by clicking 'Install' and completing the wizard by clicking 'Finish'.
Clone EI-NodeRed from GitLab
- Open Command Prompt (cmd.exe) and navigate to the './EI-NodeRed' folder.
- Type the command line
npm install
to install the Node-RED dependencies. - Type the command line
npm run build
to build the code of Node-RED. - Type the command line
npm start
ornode red.js
to run Node-RED.
Node-Red Plug-ins Categories
Category | Description | Nodes |
---|---|---|
General | The settings of IP address, port number, login username/password of WISE-PaaS server. Retrieval of device and sensor information. | 1. ServerConfig |
Common | Query the data and the information of devices, plugins and sensors. | 1. DevicesQuery 2. PluginsQuery 3. SensorsQuery 4. DataQuery |
Node-Red Plug-ins Description
Node Name | Description | Input | Output |
---|---|---|---|
ServerConfig | Set URL, port, username, and password for WISE-PaaS 2.0 server. The node provides Basic type and SSO type. | A timestamp trigger or button trigger. | msg.url, msg.port, msg.encodestr. |
DevicesQuery | Retrieve devices information from WISE-PaaS 2.0 server. User can fill a specific device ID. The text of Device ID can be blank if user wants to retrieve all devices. | ServerConfig Node. | Device information list. |
PluginsQuery | Retrieve plugins by device ID within a time range. The maximum number of values is 10000 from WISE-PaaS 2.0 server. User can set the conditions about plugins here. Ex: Device ID, Agent ID, begin timestamp, end timestamp, amount and type. | ServerConfig Node. | Plugins Information list. |
SensorsQuery | Retrieve sensors by Device ID & plugin within a time range. The maximum number of values is 10000 from WISE-PaaS 2.0 server. User can set the conditions about sensors here. Ex: Device ID, Agent ID, Plugin Name, begin timestamp, end timestamp, amount and type. | ServerConfig Node. | Sensors Information list. |
DataQuery | Retrieve data from WISE-PaaS 2.0 server. The node provides three types: history, latest, and statistic. | ServerConfig Node. | Data based on the selected type (history, latest, or statistic) by specific Device ID within a time range. |
DataQuery (History) | Retrieve data by Device ID within a time range. The maximum number of values is 10000. | ServerConfig Node. | The history data by specific Device ID within a time range. |
DataQuery (Latest) | Retrieve latest data by Device ID. | ServerConfig Node. | The latest data by specific Device ID. |
DataQuery (Statistic) | Retrieve statistic data by Device ID within a time range. (Less than 31 days.) | ServerConfig Node. | The Statistic data by specific Device ID within a time range. |
Node-Red for WISE-PaaS 2.0
General
ServerConfig
Description: Set URL, port, username, and password for WISE-PaaS 2.0 server. The node provides Basic type and SSO type.
Basic
Description: User can set Username and Password. If the user calls the restful API of the common server, the text box can be blank.
Configuration Dialog (Basic Type):
- Type: [dropdown] Basic
- Name: [text input] Node Name
- URL: [text input] localhost
- Port: [text input] 8080
- Username: [text input] admin
- Password: [password input] ********
SSO
Description: User can get accessToken here and call the restful API by the accessToken.
Configuration Dialog (SSO Type):
- Type: [dropdown] SSO
- ID: [text input] f028644c-20dbb8
- Name: [text input] Node Name
- URL: [text input] localhost
- Port: [text input] 8080
Input: A timestamp trigger or button trigger.
Output: msg.url, msg.port, msg.encodestr.
Common
DevicesQuery
Description: Retrieve devices information from WISE-PaaS 2.0 server. User can fill a specific device ID. The text of DeviceID can be blank if user wants to retrieve all devices.
Configuration Dialog:
- Name: [text input] Node Name
- DeviceID: [text input] Blank is available for all devices
Input: ServerConfig Node.
Output: Device information list.
PluginsQuery
Description: Retrieve plugins by device ID within a time range. The maximum number of values is 10000 from WISE-PaaS 2.0 server. User can set the conditions about plugins here. Ex: Device ID, Agent ID, begin timestamp, end timestamp, amount and type.
Configuration Dialog:
- Name: [text input] Node Name
- DeviceID: [text input] Device ID
- AgentID: [text input] Agent ID
- BeginTs: [text input] Begin Timestamp, e.g., 2017-04-06 00:00:00:000
- EndTs: [text input] End Timestamp, e.g., 2017-04-30 00:00:00:000
- Amount: [text input] Amount
- Type: [dropdown] ASC
Input: ServerConfig Node.
Output: Plugins Information list.
SensorsQuery
Description: Retrieve sensors by Device ID & plugin within a time range. The maximum number of values is 10000 from WISE-PaaS 2.0 server. User can set the conditions about sensors here. Ex: Device ID, Agent ID, Plugin Name, begin timestamp, end timestamp, amount and type.
Configuration Dialog:
- Name: [text input] Node Name
- DeviceID: [text input] Device ID
- AgentID: [text input] Agent ID
- Plugin: [text input] Plugin Name
- BeginTs: [text input] Begin Timestamp, e.g., 2017-04-06 00:00:00:000
- EndTs: [text input] End Timestamp, e.g., 2017-04-30 00:00:00:000
- Amount: [text input] Amount
- Type: [dropdown] ASC
Input: ServerConfig Node.
Output: Sensors Information list.
DataQuery
Description: Retrieve data from WISE-PaaS 2.0 server. The node provides three types: history, latest, and statistic.
History
Description: Retrieve data by Device ID within a time range. The maximum number of values is 10000.
Configuration Dialog (History):
- Name: [text input] Node Name
- Type: [dropdown] History
- DeviceID: [text input] Device ID
- AgentID: [text input] Agent ID
- PluginName: [text input] Plugin Name
- SensorID: [text input] Sensor Id
- BeginTs: [text input] Begin Timestamp, e.g., 2017-04-06 00:00:00:000
- EndTs: [text input] End Timestamp, e.g., 2017-04-30 00:00:00:000
- Amount: [text input] Amount
- Type: [dropdown] ASC
Input: ServerConfig Node.
Output: The history data by specific Device ID within a time range.
Latest
Description: Retrieve latest data by Device ID.
Configuration Dialog (Latest):
- Name: [text input] Node Name
- Type: [dropdown] Latest
- DeviceID: [text input] Device ID
- AgentID: [text input] Agent ID
- PluginName: [text input] Plugin Name
- SensorID: [text input] Sensor Id
Input: ServerConfig Node.
Output: The latest data by specific Device ID.
Statistic
Description: Retrieve statistic data by Device ID within a time range. (Less than 31 days.)
Configuration Dialog (Statistic):
- Name: [text input] Node Name
- Type: [dropdown] Statistic
- DeviceID: [text input] Device ID
- AgentID: [text input] Agent ID
- PluginName: [text input] Plugin Name
- SensorID: [text input] Sensor Id
- BeginTs: [text input] Begin Timestamp, e.g., 2017-04-06 00:00:00:000
- EndTs: [text input] End Timestamp, e.g., 2017-04-30 00:00:00:000
Input: ServerConfig Node.
Output: The Statistic data by specific Device ID within a time range.