MQTT Guide
Subscribe to topics, publish data, and run an embedded broker.
Overview
ControlBird's MQTT integration runs in two modes. In client mode it connects to an external MQTT broker, subscribes to topics, and turns incoming payloads into tag values; it can also publish tag values back out to topics. In broker mode it hosts an embedded MQTT broker so devices and other systems can publish and subscribe against ControlBird itself. Both modes are set up in the IO Manager app, with no configuration files.
The client speaks MQTT 3.1.1 and supports topic wildcards, QoS levels 0, 1, and 2, retained messages, and three payload formats (String, JSON, and Binary). Inbound JSON payloads can be reduced to a single value with a JSONPath expression.
New to device configuration?
If this is your first integration, start with walkthrough step 6: Connect Your First Device for a hands-on introduction, then return here for MQTT specifics. For a ready-made MQTT setup such as Zigbee2MQTT, use Add Integration in the IO Manager instead.
Client mode: connecting to a broker
An MQTT tag is one topic. Its ID is a dotted name that is unique in your tenant, for example House.Livingroom.Temperature; its source is the MQTT topic.
- Open the IO Manager, go to the Tags section, and choose Add tag to start Create Custom Device.
- Pick the MQTT card in the Client role.
- Enter a Device Name and fill in the connection form with the broker host and port (default
1883; the client connects to exactly the port you enter), and optionally a username. - In the Points step, choose Add Point for each topic. Give it a tag ID, a type, a source path holding the topic, and a direction.
- Finish the wizard. The connection starts and your tags show live values in the Tags section.
The broker does not map tags
In broker mode ControlBird is a plain message broker. Clients connect to it over standard MQTT and publish and subscribe directly. Tags that read or write topics belong on a client-mode connection.
Client connection form
| Setting | Description | Default |
|---|---|---|
| Host | Broker hostname or IP address. | localhost |
| Port | Broker TCP port. The client connects to exactly this port. | 1883 |
| Client ID | MQTT client identifier. ControlBird adds a per-node suffix so each node connects with a distinct identifier. | generated |
| Username and password | Optional login. The password is stored sealed and shown only as set or not set. | none |
| TLS and certificate | Turn on TLS and choose the certificate the client presents. Set the port to the broker's TLS port, usually 8883. | off |
| Clean session | Start a fresh session on each connect. | true |
| Keep alive | Heartbeat interval in seconds. | 60 |
| Retry backoff | Minimum and maximum reconnect wait. | 1 s / 60 s |
Tag source addresses and payloads
A tag's source path is the MQTT topic. The rest of its settings control direction, payload handling, and publish options.
| Setting | Values | Purpose |
|---|---|---|
| Source Path | topic | The MQTT topic or pattern, with + and # wildcards for reads. |
| Direction | Read, Write, ReadWrite | Inbound only, outbound only, or both. |
| QoS | AtMostOnce, AtLeastOnce, ExactlyOnce | Quality of service (default AtLeastOnce). |
| Retain | on or off | Publish as a retained message (default off). |
| Payload format | String, Json, Binary | How payload bytes are interpreted. |
| JSON path | JSONPath | Extract one value from a JSON payload, for example $.brightness. |
| Byte order | BigEndian, LittleEndian | Byte order for Binary payloads (default LittleEndian). |
Topic wildcards
MQTT topics are hierarchical, separated by /. Two wildcards work in subscription patterns:
+matches exactly one topic level, for examplesensors/+/value.#matches the remaining levels and must be the last character, for examplehouse/#.
Payload formats
| Format | Behavior |
|---|---|
| String | Raw text, stored as-is. |
| Json | Parsed as JSON. An optional JSON path extracts one value; without it the whole object is used. |
| Binary | Raw bytes read with the selected byte order. |
Extracted values are converted to the tag's value type. Format is never detected automatically, so choose Binary explicitly for binary payloads.
Examples
Subscribe to a plain-text temperature topic:
Tag ID: House.Kitchen.Temperature
Source Path: sensors/temperature
Payload format: String
Direction: ReadExtract one value from a JSON payload:
Tag ID: House.Livingroom.Brightness
Source Path: zigbee/light/brightness
Payload format: Json
JSON path: $.brightness
Direction: ReadPublish a setpoint as a retained message at QoS 1:
Tag ID: House.Hall.Setpoint
Source Path: control/setpoint
Direction: Write
QoS: AtLeastOnce
Retain: onMirror state in both directions on one topic:
Tag ID: House.Hall.Light
Source Path: devices/light/state
Direction: ReadWrite
Payload format: StringSecurity and reliability
TLS / MQTTS
Turn on TLS in the connection form, or later in the Security section of the endpoint's details, and choose the certificate the client presents. See the certificates guide for managing certificate material.
Quality of service
| QoS | Name | Guarantee |
|---|---|---|
| 0 | AtMostOnce | Fire and forget, no delivery guarantee. |
| 1 | AtLeastOnce | Delivered at least once (default), duplicates possible. |
| 2 | ExactlyOnce | Delivered exactly once via a four-way handshake. |
Reconnect behavior
On connection failure the client retries with exponential backoff between the minimum and maximum wait (1 and 60 seconds by default). The keep-alive heartbeat (60 seconds by default) lets the broker detect a dead client.
Broker mode: hosting an embedded broker
Create a connection the same way, but pick the MQTT card in the Server role. Its connection form takes:
| Setting | Description | Default |
|---|---|---|
| Host | Bind address. Use 0.0.0.0 to accept connections on all interfaces. | 0.0.0.0 |
| Port | Listen port. | 1883 |
| Max connections | Maximum concurrent client connections. | 100 |
| Max queued messages | Maximum undelivered messages queued for each connected client. | 8192 |
| Keep alive | Keep-alive interval in seconds the broker imposes on MQTT 5 clients, overriding the interval they ask for. MQTT 3.1.1 clients keep their own. | 60 |
Limitations
- The embedded broker is a plain pub/sub broker: it has no tags of its own.
- Topic length is capped at 65535 bytes, the MQTT specification limit.
Observability
Logging is on by default and records MQTT TX/RX packets. In a self-hosted, peered multi-node deployment, only one node holds the active connection or broker at a time, and the role moves automatically if that node becomes unavailable. For broader device setup, return to step 6: Connect Your First Device.