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.

  1. Open the IO Manager, go to the Tags section, and choose Add tag to start Create Custom Device.
  2. Pick the MQTT card in the Client role.
  3. 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.
  4. 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.
  5. 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

SettingDescriptionDefault
HostBroker hostname or IP address.localhost
PortBroker TCP port. The client connects to exactly this port.1883
Client IDMQTT client identifier. ControlBird adds a per-node suffix so each node connects with a distinct identifier.generated
Username and passwordOptional login. The password is stored sealed and shown only as set or not set.none
TLS and certificateTurn on TLS and choose the certificate the client presents. Set the port to the broker's TLS port, usually 8883.off
Clean sessionStart a fresh session on each connect.true
Keep aliveHeartbeat interval in seconds.60
Retry backoffMinimum 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.

SettingValuesPurpose
Source PathtopicThe MQTT topic or pattern, with + and # wildcards for reads.
DirectionRead, Write, ReadWriteInbound only, outbound only, or both.
QoSAtMostOnce, AtLeastOnce, ExactlyOnceQuality of service (default AtLeastOnce).
Retainon or offPublish as a retained message (default off).
Payload formatString, Json, BinaryHow payload bytes are interpreted.
JSON pathJSONPathExtract one value from a JSON payload, for example $.brightness.
Byte orderBigEndian, LittleEndianByte 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 example sensors/+/value.
  • # matches the remaining levels and must be the last character, for example house/#.

Payload formats

FormatBehavior
StringRaw text, stored as-is.
JsonParsed as JSON. An optional JSON path extracts one value; without it the whole object is used.
BinaryRaw 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:      Read

Extract one value from a JSON payload:

Tag ID:         House.Livingroom.Brightness
Source Path:    zigbee/light/brightness
Payload format: Json
JSON path:      $.brightness
Direction:      Read

Publish a setpoint as a retained message at QoS 1:

Tag ID:      House.Hall.Setpoint
Source Path: control/setpoint
Direction:   Write
QoS:         AtLeastOnce
Retain:      on

Mirror state in both directions on one topic:

Tag ID:         House.Hall.Light
Source Path:    devices/light/state
Direction:      ReadWrite
Payload format: String

Security 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

QoSNameGuarantee
0AtMostOnceFire and forget, no delivery guarantee.
1AtLeastOnceDelivered at least once (default), duplicates possible.
2ExactlyOnceDelivered 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:

SettingDescriptionDefault
HostBind address. Use 0.0.0.0 to accept connections on all interfaces.0.0.0.0
PortListen port.1883
Max connectionsMaximum concurrent client connections.100
Max queued messagesMaximum undelivered messages queued for each connected client.8192
Keep aliveKeep-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.