In industrial IoT environments, capturing Bluetooth Low Energy (BLE) data typically requires complex integration between hardware drivers and application software. This solution utilizes Pareto Anywhere on the Robustel EG5120 gateway to parse raw HCI events into structured JSON data. It then leverages Node-RED to bridge this data into the E2C Factory platform for professional SCADA visualization.
bluez and libcap2-bin.Ensure the gateway has the latest packages and the required runtime environment.
sudo apt-get updatesudo apt-get install -y build-essential bluetooth bluez libcap2-bincurl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -sudo apt-get install -y nodejssudo npm install -g pm2Install the core middleware and grant the necessary permissions for hardware access.
sudo npm install -g pareto-anywheresudo npm install -g barnowl-hcicd /usr/local/.npm-global/lib/node_modules/barnowl-hcisudo npm run privilegesUse PM2 to run the barnowl-hci-forwarder as a persistent service using absolute paths.
pm2 start /usr/local/.npm-global/lib/node_modules/barnowl-hci/bin/barnowl-hci-forwarder --name "barnowl-hci-forwarder" --restart-delay 5000 Note: The 5000ms delay prevents service flapping during hardware resets.
2. Start the Pareto Anywhere Engine:
pm2 start /usr/local/.npm-global/lib/node_modules/pareto-anywhere/bin/pareto-anywhere --name "pareto-anywhere" The EG5120 requires a background loop to maintain active scanning for data capture.
sudo hciattach /dev/ttymxc3 any 115200 flowhciconfig hci0 uppm2 start "while true; do btmgmt --index 0 find -l > /dev/null 2>&1; sleep 5; done" --name "ble-scanner"pm2 saveEnsure the engine is running and will persist through reboots.
pm2 restart pareto-anywherepm2 savepm2 startup (Follow the on-screen instructions to enable auto-start).This step bridges the parsed Pareto data to the E2C Factory platform for visualization.
cd /app/node-red/origin/backendnpm install @reelyactive/node-red-pareto-anywhere --save --unsafe-permpm2 restart node-red-apppareto-anywhere-socketio node (Server: http://localhost:3001) and connect it to a function node with the following code:// 1. Safety Check: Ensure payload exists and contains isLiquidDetected array
if (!msg.payload || !Array.isArray(msg.payload.isLiquidDetected) || msg.payload.isLiquidDetected.length === 0) {
return null; // Silent drop if not water leak sensor data
}
try {
const data = msg.payload;
// 2. Extraction and String Conversion (for E2C PRO compatibility)
const mac = String(data.deviceId || "unknown");
const battery = String(data.batteryPercentage || "0");
// Safely extract leak boolean and convert to status string
const isLeaking = data.isLiquidDetected[0];
const leakStatus = isLeaking ? "Warning" : "Normal";
// 3. Construct Payload for E2C Mapping
// Ensure keys (e.g., BLE_RSSI) match the "Identifiers" in E2C Variable Management
msg.payload = {
"BLE_MAC": mac,
"BLE_BATTERY": battery,
"BLE_LEAK_STATUS": leakStatus,
"BLE_UPDATE_TIME": new Date().toLocaleString()
};
return msg;
} catch (e) {
node.error("Pareto logic parsing error: " + e.message);
return null;
}
pm2 status. All services (barnowl-hci-forwarder, pareto-anywhere, ble-scanner) should be online.curl -s http://localhost:3001/devices/. It should return a JSON object with discovered device IDs.Q1: Why is my E2C Dashboard not updating even though Node-RED shows "Data Sent"?
A: This is most commonly caused by a Variable Identifier mismatch. Ensure that the keys defined in your Node-RED msg.payload (e.g., BLE_LEAK_STATUS) match the Identifier (Tag name) configured in the E2C Data Collection settings exactly—including case sensitivity and underscores.
Q2: Why is BLE telemetry, though verified via the local APIcurl, failing to populate within the E2C Factory SCADA interface?
A: The provided Node-RED function node includes a safety pre-check for the isLiquidDetected property. This logic is designed to filter out general BLE traffic and only process specific water-leak sensors. If you are using a different type of sensor (e.g., temperature), you must update the pre-check logic in the function node to match your sensor's data properties.
Q3: Node-RED displays "Connected" but no data appears in the debug panel.
A: Verify that the HCI Scanning Loop (ble-scanner) is running. On the EG5120, the Bluetooth radio may stop discovering new advertisements if the active search command is interrupted. Run pm2 status to ensure ble-scanner is online; if it is, try running hciconfig hci0 up manually to ensure the hardware interface is active.
Q4: Services fail to start automatically after the EG5120 reboots.
A: PM2 requires a saved process list and a registered startup script. After all services are running, you must execute pm2 save. Then, run pm2 startup and follow the instructions to copy/paste the generated command into your terminal to enable the boot-time service.
Version | Date | Author | Changes |
1.0 | 2026-02-03 | Steven Lin | Initial document. |