Connect Node-RED via Mosquitto MQTT to the Service Mesh

This practical example demonstrates how to integrate Node-RED, a popular flow-based programming tool, with the FLECS Service Mesh using the Mosquitto MQTT Broker. This setup allows for efficient data exchange between Node-RED and other applications within the FLECS ecosystem.


  • Ensure FLECS Core is installed on your system. Refer to the installation guide if necessary:Installing FLECS Core

  • FLECS Service Mesh and FLECS MQTT Bridge should be installed and operational.

Example Setup

Install Mosquitto MQTT Broker

  1. Navigate to the Marketplace on your device.

  2. Search for 'Mosquitto MQTT Broker' and click 'Install'.

Install Node-RED

  1. Search for 'Node-RED' in the Marketplace and click 'Install'.

Configure Node-RED for MQTT

  1. Go to 'Apps' and select 'OPEN APP' under Node-RED.

  1. Drag and drop an 'Inject Node' and an 'MQTT out Node' to your flow and connect them.

  1. Double-click the timestamp node to set payload, topic, and interval. Click 'Done'.

  1. Double-click the MQTT node, add the server 'flecs-mqtt' with port 1883. Confirm with 'Edit' and 'Done'.

  1. Click 'Deploy' to activate your Node-RED flow.

Testing and verification

  1. Ensure your Node-RED flow is actively sending/receiving messages via the MQTT node.

  2. In the FLECS UI, check the Service Mesh section to verify the FLECS MQTT Bridge's communication with the Mosquitto Broker.

  3. Look for a timestamp from Node-RED every 5 seconds as an indication of successful data exchange.

Troubleshooting Tips

  • If connection issues arise, review the Mosquitto Broker and Node-RED logs for diagnostics.

  • Confirm that network settings, like firewalls, are not obstructing MQTT traffic on port 1883.

  • If you are experiencing connection issues, it may be necessary to restart the relevant app instances. Follow these steps in the specified order for a systematic reset:

    1. Stop the App Instances:

      • First, stop the instances of FLECS Service Mesh, FLECS MQTT Bridge, and Mosquitto MQTT Broker Apps on your device.

    2. Restart in Sequence:

      • Begin by restarting the FLECS Service Mesh.

      • Next, restart the FLECS MQTT Bridge.

      • Finally, restart the Mosquitto MQTT Broker.

    By stopping and then sequentially restarting these components, you can often resolve connectivity issues and ensure a smooth data exchange within the FLECS ecosystem.

By following these steps, Node-RED is effectively integrated into the FLECS Service Mesh, providing a dynamic and versatile environment for data exchange within your industrial automation system.

Last updated