Connect Node-RED via Mosquitto MQTT to the Service Mesh
Last updated
Last updated
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.
Navigate to the Marketplace on your device.
Search for 'Mosquitto MQTT Broker' and click 'Install'.
Search for 'Node-RED' in the Marketplace and click 'Install'.
Go to 'Apps' and select 'OPEN APP' under Node-RED.
Drag and drop an 'Inject Node' and an 'MQTT out Node' to your flow and connect them.
Double-click the timestamp node to set payload, topic, and interval. Click 'Done'.
Double-click the MQTT node, add the server 'flecs-mqtt' with port 1883. Confirm with 'Edit' and 'Done'.
Click 'Deploy' to activate your Node-RED flow.
Ensure your Node-RED flow is actively sending/receiving messages via the MQTT node.
In the FLECS UI, check the Service Mesh section to verify the FLECS MQTT Bridge's communication with the Mosquitto Broker.
Look for a timestamp from Node-RED every 5 seconds as an indication of successful data exchange.
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:
Stop the App Instances:
First, stop the instances of FLECS Service Mesh, FLECS MQTT Bridge, and Mosquitto MQTT Broker Apps on your device.
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.