Node-RED: Simple example: Using Node-RED with the MQTT server

This documentation is part of the MQTT Server guide. You can view the complete guide here: How to connect Node-RED to the Mosquitto MQTT server.

Welcome to the Stackhero documentation

Stackhero offers a fully managed Node-RED cloud environment designed to help you build workflows quickly:

  • Integrated MQTT server (Mosquitto) for seamless IoT integration.
  • Full access to the Node-RED admin interface for managing your flows and settings.
  • Node-RED Dashboard included for real-time visualization.
  • Dedicated SMTP email server included, with no sending limits.
  • Effortless one-click updates to easily keep your instance up to date.
  • Custom domain names with automatic HTTPS: for example, https://node-red.your-company.com.
  • High performance and enhanced security thanks to private, dedicated infrastructure.

You can have a secure, production-ready Node-RED cloud hosting instance up and running in about 5 minutes. Stackhero takes care of installation, updates, and infrastructure so you can focus on building your automations.

If you're just getting started with MQTT in Node-RED, here's a straightforward example to help you get up and running quickly. This example demonstrates how to send a message to a topic and receive messages from it. You can download the flow example and import it into your Node-RED instance using the "Import" menu.

Simple example of connecting MQTT to Node-REDSimple example of connecting MQTT to Node-RED

If your MQTT nodes are stuck in the "connecting" state, it's a good idea to check if the MQTT authentication flow is still present. If it's missing, you can download it here: mqttAuthenticationFlow.json. Import this flow into your Node-RED instance, update the Users node with your chosen passwords, and remove any unnecessary comments as needed.