Publishing messages to an MQTT topic
- Open Node-RED.
- Add an mqtt node from the output category to the workspace.
- Connect the input of the mqtt node to the output of the node whose output you want to publish.
- Double-click the mqtt node to open the Edit node dialogue.
- In the Server drop-down list, select a server to connect to or add a new MQTT broker.

You can set topic, QoS and retain dynamically via message properties by leaving the corresponding fields blank.
- In the Topic text box, enter the topic you want the node to publish to.
- In the QoS drop-down lists, select the Quality of Service level of the respective message. Choose from:
- 0 (fire and forget): Arrival of the message solely relies on the underlying Internet Protocol network. Message loss may occur.
- 1 (at least once): The message is assured to arrive, but may arrive more than once.
- In the Retain drop-down list, select whether messages shall be retained on the broker.
- Click Done to apply your changes.