1. Home
  2. LegacyConnector
  3. Visual Programming
  4. Virtual Interface
  5. Example

Example

In this example we will build a simple application, where we simulate sensor data using Inject node. Then we create a parser to handle the data to be compatible we Virtual Interface Node.

Step 1. Add nodes and connect them

Inject Node,
Function Node,
Virtual Interface,
Debug Nodes,

Step 2. Configure Inject node

Select Json and paste this Json:
{"bat":2000,"temp":23,"hum":68}
Simulates a Battery power Temperature Sensor.

Step 3. Configure Parser

Code use:
var payload = msg.payload;
var msg0={
"variable":"bat.rawValue",
"value":payload["bat"]
}
var msg1={
"variable":"temp.rawValue",
"value":payload["temp"]
}
var msg2={
"variable":"hum.rawValue",
"value":payload["hum"]
}return [msg0,msg1,msg2];

Step 4. Configure Virtual Interface

You need to make sure that the names used on the Parser and on the Virtual Interfaces are the same.

Step 5. Deploy Flow

You can download this flow here, and import into our Visual Programming.

Was this article helpful to you? Yes No

How can we help?