Using EdgeX with Node-RED for Edge Analytics

Node-RED is a programming tool for conveniently connecting software and services together in new and interesting ways. Node-RED provides a visual browser-based editor allowing for the easy creation of data flows using the wide range of nodes in the palette. The flows can be then deployed to the runtime with a single-click. JavaScript functions can be created using the rich text editor. A built-in library also allows you to save useful functions, templates and flows for re-use.

Node-RED can easily be used with EdgeX to provide a flexible and dynamic mechanism for users to add their own application specific edge analytics to an EdgeX system. The use of Node-RED enables data flowing through EdgeX to be processed and acted on in “near” real-time. It is particularly useful technology for prototyping and testing out ideas in support of POC (Proof-Of-Concept) projects. Node-RED can be used as an alternative to the default Rules Engine provided with EdgeX as shown in the diagram below.

Node-RED has many built-in features that help when working with EdgeX such as readily available MQTT and REST nodes that can be configured to ingest data into Node-RED. As an example, the EdgeX Export Services can be used to deliver data (EdgeX events/readings) to MQTT, which can then be imported into Node-RED via an MQTT Subscriber node. Using the Node-RED editor, a user can define and deploy their own business logic that can process and act on the received data. For example, an action or decision taken by the Node-RED analytics could be used to send a command to actuate a device via the EdgeX Command microservice. This interaction is shown in the following diagram.


To make things even more convenient, IOTech’s Edge Xpert implementation of the EdgeX Foundry open source code is delivered with dockerized containers for Node-RED and the Mosquitto MQTT broker. This allows for the easier control and deployment of the whole edge system as each of the software components can be managed within the microservice architecture.

An example of using the Node-RED microservice with EdgeX to process and display device generated data is provided with the EdgeX Community DevKit