MQTT Subscribe
Subscribe to a topic on an MQTT broker and output the latest payload received.
What it does
MQTT Subscribe connects to an MQTT broker and listens on a topic, feeding whatever arrives into the graph as a live, continuously-updating input. It is the bridge to IoT sensors, lighting and installation controllers, and other apps that speak MQTT.
Given a broker and a topic, it outputs the latest payload as text, the same payload parsed as a number, and whether the subscription is currently connected.
When to use it
A temperature, light, distance or other sensor reading from an IoT device driving a parameter live
A bridge to another app, show-control system or installation controller that publishes over MQTT
One node fanning out over many related topics at once, using the
+and#wildcards
| Parameter | Type | Default |
|---|---|---|
broker | String | "localhost" |
port | Number | 1883 |
topic | String | "sensors/temperature" |
Gotchas
Topic supports MQTT wildcards:
+matches a single level,#matches everything below. Use them to subscribe to a family of topics, for examplesensors/+/temperature, instead of one node per sensor.The Value output only makes sense when the incoming payload is numeric text. For JSON or a non-numeric string, read Payload and parse it downstream.
Check Connected before trusting Payload or Value. Until the subscription connects, or after the broker drops, the outputs hold whatever they last received rather than a fresh reading.
Worked example
Add an MQTT Subscribe node. Set Broker to your broker's hostname and Port to match (1883 is the common default).
Set Topic to the channel you want, e.g.
sensors/temperature, or use a wildcard likesensors/+/temperatureto catch several sensors.Wire Connected to something visible while testing, to see the moment the subscription comes alive.
Wire Value into a param for a live numeric feed, or wire Payload downstream if you need the raw text.
See also
MQTT Publish · OSC Input · WebSocket Input · Numbers, signals & audio