Skip to content

MQTT SCADA driver

Turn MQTT topics into tags.

The MQTT driver connects to a broker, subscribes each tag to a topic and decodes the payload into a value. A write publishes it back. It comes with the core.

How you connect it

From a MQTT broker to live values.

  1. Add the broker

    Under Connections, add an MQTT broker with its URL, such as mqtt://host:1883. Put the username and password in their own fields, not in the URL. Choose MQTT 5.0 or 3.1.1 and the default QoS.

  2. Test the connection

    Test connection connects with a throwaway client id, gives up after 5 seconds and reports the latency.

  3. Browse the topics

    Browse topics scans the broker's topics and lists every one it sees, with the last payload and whether it was retained. By default it scans everything under #; you can limit the scan to the filters you choose.

  4. Make the tags

    Pick the topics and create the tags. Each is bound to a topic or a topic filter, with a payload format to decode it: text, number, boolean or JSON.

What it does

What the MQTT driver does for you.

Topics and wildcards

A tag can follow one topic or a filter: + matches one level and # matches the rest. A retained value is sent again when a tag is restarted.

Four payload formats

Text as it is, a number, a boolean (true, 1, on or false, 0, off) or JSON. A payload that does not decode makes the tag bad, and says why.

Writes publish back

Writing to a tag publishes the value to its topic at the connection's QoS, not retained. A tag bound to a wildcard filter cannot be written.

TLS with the broker's certificate checked

mqtts and wss use TLS and check the broker's certificate, unless you trust any certificate for a self-signed one. This version has no client certificates and no custom certificate authority.

Keeps the last value when the broker goes

While the broker is unreachable every bound tag is bad and keeps its last value, and the driver retries every 5 seconds.

The link is a tag too

Each connection publishes its state, message rates, topics seen and dropped samples as tags with history.

Settings

What you set, and what it starts as.

The settings of an MQTT connection
SettingWhat it doesDefault
Broker URLWhere the broker listens: mqtt or tcp (port 1883), mqtts, ssl or tls (port 8883), ws and wss. Required.None
Username and passwordCredentials sent at connect. The password is stored encrypted and never returned by the API.Empty
MQTT version5.0 or 3.1.1. Some brokers, mostly older ones, speak 3.1.1 only.5.0
Default QoS0, 1 or 2, used for every subscription and every publish of the connection.0
Trust any certificateFor a broker with a self-signed certificate. The connection is still encrypted.Off

What has been tried

As far as it has been tested, and no further.

MQTT

The driver has run against Mosquitto. No other broker has been tried.

The driver comes with the core.

Questions

Questions people ask.

Which MQTT brokers does it work with?

It has run against Mosquitto. No other broker has been tried. It speaks MQTT 5.0 and 3.1.1, so use Test connection on yours before you rely on it.

Can I use JSON payloads?

Yes. With the JSON format the payload is parsed and lands as one value, an object, an array or a single value. There is no JSON path in this version: pick a field with an expression tag or a derived member.

Is the connection encrypted?

With mqtts or wss, yes. The driver checks the broker's certificate unless you turn on Trust any certificate for a self-signed one.

Can Scadex be the broker?

Yes. The MQTT broker is a separate add-on that lets your own tools read the plant's values as topics.

Other ways in

Connect more than one kind of equipment.

Interested in learning more?

Tell us about your plant and what you run today, or what you want to build on it. We answer in plain language.