MQTT Publish
Publish values to a topic on an MQTT broker.
What it does
MQTT Publish sends a number out to an MQTT broker on a named topic. A number wired into Input goes out as a string payload each time the graph sends, bridging the node graph to lighting rigs, home-automation hubs, microcontrollers, or any other software listening on that broker.
Broker and Port point at the MQTT server, Topic is the channel other devices subscribe to, and Send fires the publish. The value also passes through Output for continued use downstream.
When to use it
A real-world device (a light, a relay, a motor) driven from values computed in the graph
An installation, home-automation system or other app that talks MQTT
A live number (a slider, an audio level, a tracked value) broadcast to other software on the network
| Parameter | Type | Default |
|---|---|---|
broker | String | "localhost" |
port | Number | 1883 |
topic | String | "control/brightness" |
input | Number | — |
send | Boolean | false |
Gotchas
Nothing is sent until Send is switched on. Off is the default, and it is a silent no-op, so check Send first when a device is not reacting.
Only a number can be published; the value is converted straight to a string. Convert anything else to a number upstream first.
With Input unwired the node still runs, using a placeholder value rather than failing. Wire a real number in to publish something meaningful.
Worked example
Add an MQTT Publish node. Set Broker to your MQTT server's hostname and Port to match (1883 is the common default).
Set Topic to the channel your device or app is subscribed to, e.g.
control/brightness.Wire a number, a slider, an audio level or a computed value, into Input.
Switch Send on to start publishing that value out to the broker.
See also
MQTT Subscribe · OSC Output · DMX Output · Numbers, signals & audio