Parameters

Name Values Description
Type MQTT The connector type identifier.
Address IP address or hostname The MQTT broker's address.
Port integer The broker's MQTT port.
ClientId string The MQTT client identifier to connect with.
Username / Password string Broker credentials, if required.
Version MQTT protocol version The MQTT protocol version to connect with (e.g. v3.1.1 or v5.0.0).
QOS 0, 1, or 2 The default Quality of Service level for publishes (AtMostOnce/AtLeastOnce/ExactlyOnce). Defaults to AtLeastOnce.
Retain true/false Whether published messages are retained by the broker. Defaults to true unless explicitly set to false.
Persistent true/false Whether to request a persistent (non-clean) session from the broker.

Overview

The MQTT connector provides tag-based subscription and on-demand publish access to a general-purpose MQTT broker, using MQTTnet. Unlike the device-level connectors, it has no polling loop of its own - all of its periodic work (connection monitoring, reconnection, and the heartbeat) runs inside a single dedicated background loop.

Incoming messages on a subscribed topic are written directly to whichever tag's Address matches that topic. Publishing (SENDDATA/PUBLISHDATA) is available on demand via connector methods.

The connector detects when the broker connection is lost and reconnects automatically without blocking - reconnection runs on its own dedicated background thread, and an explicit disconnect is issued before every reconnect attempt to avoid MQTTnet's own "not allowed to connect while connect/disconnect is pending" race.

Supported Tag Types:

Every MQTT payload is plain text, so there's no DataType disambiguation needed - the raw payload string is passed straight to each tag's own SetValue, and the tag type itself (BoolTag/IntTag/DecimalTag/StringTag/etc.) handles its own coercion.

Tag Type Address Behaviour
Any standard tag An MQTT topic, matched case-insensitively Subscribed on connect; updated whenever a message arrives on that topic.

Connector Methods

Name Arguments Description
SendData Topic Builds a payload from a configured schema (populated via DATA|<field> args) and publishes it to the given topic.
PublishData Topic, Data Publishes an arbitrary payload to the given topic.
ResetTag Name, Value Sets a tag's value directly, without going through MQTT.

Addressing

The Address field of a tag is the literal MQTT topic to subscribe to. Publishing is only available via RunMethod("SENDDATA"/"PUBLISHDATA") - there's no tag-driven "write triggers a publish" mechanism.