[{"data":1,"prerenderedAt":401},["ShallowReactive",2],{"node-red-\u002Fnode-red\u002Fcore-nodes\u002Fmqtt-out":3},{"id":4,"title":5,"body":6,"description":16,"extension":394,"meta":395,"navigation":396,"path":397,"seo":398,"stem":399,"__hash__":400},"nodeRed\u002Fnode-red\u002Fcore-nodes\u002Fmqtt-out.md","Node-RED - MQTT Out Node",{"type":7,"value":8,"toc":373},"minimark",[9,14,21,29,34,49,65,69,83,87,90,116,120,129,133,136,147,153,157,166,176,180,183,211,215,218,256,260,266,272,275,289,295,301,329,339,343,346,351,355,369],[10,11,13],"h1",{"id":12},"mqtt-out","MQTT Out",[10,15,17],{"id":16},"",[18,19],"binding",{"value":20},"meta.title",[22,23,24,25,28],"p",{},"The MQTT Out node connects to an MQTT broker and publishes messages to one or more topics.",[26,27],"br",{},"\nIt is typically used to send sensor data, commands, or event notifications from Node-RED to external systems or devices that subscribe to MQTT topics.",[30,31,33],"h2",{"id":32},"how-it-works","How it works",[22,35,36,37,41,42,44,45,48],{},"When a message arrives at the node input, it publishes the content of ",[38,39,40],"code",{},"msg.payload"," to the specified topic on the broker.",[26,43],{},"\nIf no topic is set in the node, it must be provided in ",[38,46,47],{},"msg.topic",".",[22,50,51,52,54,55,57,58,60,61,64],{},"If ",[38,53,40],{}," is not set, no message will be sent.",[26,56],{},"\nTo send an empty message, set ",[38,59,40],{}," to an empty string (",[38,62,63],{},"\"\"",").",[30,66,68],{"id":67},"configuration","Configuration",[22,70,71,72,74,75,79,80,82],{},"The MQTT Out node requires a connection to an MQTT broker.",[26,73],{},"\nThis can be configured by clicking the pencil icon next to the ",[76,77,78],"strong",{},"Server"," field.",[26,81],{},"\nMultiple MQTT nodes (in or out) can share the same broker configuration.",[84,85,78],"h3",{"id":86},"server",[22,88,89],{},"Defines the broker connection details:",[91,92,93,101,104,107,110,113],"ul",{},[94,95,96,97,100],"li",{},"Broker address (for example, ",[38,98,99],{},"test.mosquitto.org",")",[94,102,103],{},"Port (default 1883 for non-TLS, 8883 for TLS)",[94,105,106],{},"Optional username and password",[94,108,109],{},"MQTT version (v3.1, v3.1.1, or v5)",[94,111,112],{},"Enable TLS for encrypted connections",[94,114,115],{},"Client ID and session options",[84,117,119],{"id":118},"topic","Topic",[22,121,122,123,125,126,128],{},"Specifies the MQTT topic to publish to.",[26,124],{},"\nYou can enter a fixed topic or leave it blank to use ",[38,127,47],{}," dynamically.",[84,130,132],{"id":131},"qos","QoS",[22,134,135],{},"Defines the message delivery quality level:",[91,137,138,141,144],{},[94,139,140],{},"0 – fire and forget",[94,142,143],{},"1 – at least once",[94,145,146],{},"2 – once and once only (default)",[22,148,149,150,48],{},"The QoS can be overridden at runtime using ",[38,151,152],{},"msg.qos",[84,154,156],{"id":155},"retain","Retain",[22,158,159,160,162,163,48],{},"If set to true, the broker will retain the last message sent to the topic and deliver it to new subscribers immediately.",[26,161],{},"\nYou can override this in the flow using ",[38,164,165],{},"msg.retain",[22,167,168,169,172,173,48],{},"To clear a retained topic, send a blank message (",[38,170,171],{},"msg.payload = \"\"",") with ",[38,174,175],{},"msg.retain = true",[30,177,179],{"id":178},"input-properties","Input properties",[22,181,182],{},"The MQTT Out node accepts the following properties in incoming messages:",[91,184,185,196,201,206],{},[94,186,187,189,190,192,193,195],{},[38,188,40],{}," (string | buffer) – the message payload to publish.",[26,191],{},"\nIf it contains an object, it is automatically converted to a JSON string.",[26,194],{},"\nIf it contains a buffer, it is sent as-is.",[94,197,198,200],{},[38,199,47],{}," (string) – the topic to publish to. Required if not defined in the node.",[94,202,203,205],{},[38,204,152],{}," (number) – overrides the configured QoS (0, 1, or 2).",[94,207,208,210],{},[38,209,165],{}," (boolean) – overrides the retain flag.",[84,212,214],{"id":213},"mqtt-v5-properties","MQTT v5 properties",[22,216,217],{},"If the broker and node are using MQTT version 5, the following properties can also be set:",[91,219,220,226,232,238,244,250],{},[94,221,222,225],{},[38,223,224],{},"msg.responseTopic"," (string) – the MQTT response topic for the message",[94,227,228,231],{},[38,229,230],{},"msg.correlationData"," (buffer) – correlation data for the message",[94,233,234,237],{},[38,235,236],{},"msg.contentType"," (string) – the content type of the payload",[94,239,240,243],{},[38,241,242],{},"msg.userProperties"," (object) – any user-defined properties",[94,245,246,249],{},[38,247,248],{},"msg.messageExpiryInterval"," (number) – expiry time, in seconds",[94,251,252,255],{},[38,253,254],{},"msg.topicAlias"," (number) – topic alias to use",[30,257,259],{"id":258},"dynamic-control","Dynamic control",[22,261,262,263,265],{},"The MQTT Out node can also respond to special control messages to manage the connection dynamically.",[26,264],{},"\nIf one of these control messages is received, the node will perform the action but will not publish the payload.",[84,267,269],{"id":268},"msgaction",[38,270,271],{},"msg.action",[22,273,274],{},"Defines the action to perform. Supported actions:",[91,276,277,283],{},[94,278,279,282],{},[38,280,281],{},"connect"," – establish a connection to the broker",[94,284,285,288],{},[38,286,287],{},"disconnect"," – close the current connection",[84,290,292],{"id":291},"msgbroker",[38,293,294],{},"msg.broker",[22,296,297,298,300],{},"For the ",[76,299,281],{}," action, this property can override broker configuration options dynamically, including:",[91,302,303,308,313,319,324],{},[94,304,305],{},[38,306,307],{},"broker",[94,309,310],{},[38,311,312],{},"port",[94,314,315,318],{},[38,316,317],{},"url"," (overrides both broker and port)",[94,320,321],{},[38,322,323],{},"username",[94,325,326],{},[38,327,328],{},"password",[22,330,331,332,335,336,338],{},"If the node is already connected and new settings are provided, it will log an error unless the property ",[38,333,334],{},"force"," is set to true.",[26,337],{},"\nIn that case, it will disconnect, apply the new configuration, and reconnect.",[30,340,342],{"id":341},"example-simple-publish","Example: Simple Publish",[22,344,345],{},"This example shows how to publish a timestamp to an MQTT topic on the public Mosquitto test broker.",[347,348],"render-flow",{":height":349,"flow":350},"200","W3siaWQiOiJjMWIyMGY0NWMzYzNlNzdlIiwidHlwZSI6InRhYiIsImxhYmVsIjoiTVFUVCBQdWJsaXNoIEV4YW1wbGUiLCJkaXNhYmxlZCI6ZmFsc2UsImluZm8iOiIiLCJlbnYiOltdfSx7ImlkIjoiZTViMzE5MTlhMzVkN2Y1MSIsInR5cGUiOiJpbmplY3QiLCJ6IjoiYzFiMjBmNDVjM2MzZTc3ZSIsIm5hbWUiOiJJbmplY3QgVGltZXN0YW1wIiwicHJvcHMiOlt7InAiOiJwYXlsb2FkIn0seyJwIjoidG9waWMiLCJ2dCI6InN0ciJ9XSwicmVwZWF0IjoiIiwiY3JvbnRhYiI6IiIsIm9uY2UiOmZhbHNlLCJvbmNlRGVsYXkiOjAuMSwidG9waWMiOiJleGFtcGxlL3RpbWUiLCJwYXlsb2FkIjoiIiwicGF5bG9hZFR5cGUiOiJkYXRlIiwieCI6MTgwLCJ5IjoxMjAsIndpcmVzIjpbWyI2Y2QxMmNlY2I4Mjg4OWUyIl1dfSx7ImlkIjoiNmNkMTJjZWNiODI4ODllMiIsInR5cGUiOiJtcXR0IG91dCIsInoiOiJjMWIyMGY0NWMzYzNlNzdlIiwibmFtZSI6Ik1RVFQgT3V0IiwidG9waWMiOiIiLCJxb3MiOiIxIiwicmV0YWluIjoiZmFsc2UiLCJicm9rZXIiOiJkYTRkOGI5MC4zYTg5ZDgiLCJ4Ijo0MzAsInkiOjEyMCwid2lyZXMiOltdfSx7ImlkIjoiZGE0ZDhiOTAuM2E4OWQ4IiwidHlwZSI6Im1xdHQtYnJva2VyIiwibmFtZSI6IlB1YmxpYyBNb3NxdWl0dG8gQnJva2VyIiwiYnJva2VyIjoidGVzdC5tb3NxdWl0dG8ub3JnIiwicG9ydCI6IjE4ODMiLCJjbGllbnRpZCI6IiIsImF1dG9Db25uZWN0Ijp0cnVlLCJ1c2V0bHMiOmZhbHNlLCJwcm90b2NvbFZlcnNpb24iOiI0Iiwia2VlcGFsaXZlIjoiNjAiLCJjbGVhbnNlc3Npb24iOnRydWV9XQ==",[30,352,354],{"id":353},"notes","Notes",[91,356,357,360,363,366],{},[94,358,359],{},"The node automatically converts objects to JSON strings when publishing.",[94,361,362],{},"For large payloads or binary data, use buffers to avoid unnecessary conversion.",[94,364,365],{},"Multiple MQTT Out nodes can share the same broker connection.",[94,367,368],{},"MQTT v5 users can take advantage of additional properties for richer message metadata.",[30,370,372],{"id":371},"node-documentation","Node Documentation",{"title":16,"searchDepth":374,"depth":374,"links":375},2,[376,377,384,387,391,392,393],{"id":32,"depth":374,"text":33},{"id":67,"depth":374,"text":68,"children":378},[379,381,382,383],{"id":86,"depth":380,"text":78},3,{"id":118,"depth":380,"text":119},{"id":131,"depth":380,"text":132},{"id":155,"depth":380,"text":156},{"id":178,"depth":374,"text":179,"children":385},[386],{"id":213,"depth":380,"text":214},{"id":258,"depth":374,"text":259,"children":388},[389,390],{"id":268,"depth":380,"text":271},{"id":291,"depth":380,"text":294},{"id":341,"depth":374,"text":342},{"id":353,"depth":374,"text":354},{"id":371,"depth":374,"text":372},"md",{},true,"\u002Fnode-red\u002Fcore-nodes\u002Fmqtt-out",{"title":5,"description":16},"node-red\u002Fcore-nodes\u002Fmqtt-out","gLFzXdV2-s7QgC1KFvXMo5RKH6xtFSfFZM-ixnpMeso",1780070555958]