MQTT Client Driver

MQTT stands for Message Queuing Telemetry Transport

The MQTT Client Driver can transfer information to and from an MQTT broker, either on your local intranet or on the Internet. You may then log, view, alarm and report on values from devices connected to that host, in your VTScada system.

Never share a TCP/IP Port tag with multiple MQTT Client Drivers. Each driver must use its own port tag.

Redundant broker setup using DriverMUX

If a device is configured to use two redundant brokers, VTScada can accommodate this with the Driver Multiplexer tag and two MQTT drivers. The Driver Multiplexer should be configured with the following setup:

  • Selection Mode -> Automatic
  • Sequence Mode -> Parallel
  • Failover Mode -> Switch Server First
  • Write Mode -> Both Devices
  • Ignore Data From Inactive Subordinate -> deselected

If using a Driver Multiplexer, the MQTT driver should not use the Automatic Tag Creation option since the I/O tags cannot be placed under the subordinate MQTT driver.

Server List

Select (or create) a named server list. (Driver Server Lists) Servers for the list must be defined using the Application Configuration dialog, as described in Servers for Specific Services. Smaller sites that do not have multiple servers, or that use only the default server list, need not configure this field.

MQTT Client Driver properties Connection tab

Set the communication properties of the driver with the following fields:

Port

Select the TCP/IP Port tag that holds the address information for the MQTT data source.
MQTT data is available only over TCP/IP connections.

When configuring your TCP/IP tag, note that port 1883 is reserved with IANA for use with MQTT. Port 8883 is registered with IANA for use with MQTT over SSL. Your data source may use a different port.

This port must not be shared with any other clients.

MQTT Client ID

Every MQTT client must have a unique identifier. This is generated for you using the following four components to guarantee uniqueness on the broker as well as across VTScada applications and within the same application across multiple machines

  • Either of a configuration property called "MQTTClientIDPrefix" if set (useful for branding) or the string "VTScada"
  • The application's GUID (guaranteed unique identifier)
  • The workstation's unique identifier
  • This tag's name

Sparkplug B SCADA Host ID

This field is generated automatically and is common to all instances of the MQTT Client Driver in an application. The SCADA Host ID should be entered into the EoN configuration of the remote device, if supported by that device.

Keep Alive

Specifies the number of seconds, after which the connection will close if no new data is received.

Ensure that the Disconnect Delay in your TCP/IP Port tag is greater than the Keep Alive time set here.

QoS

QoS stands for Quality of Service and specifies an agreement between the sender and receiver of a message. Zero is the lowest quality and should be used for reliable connections and where you do not mind if the occasional message is lost. Use QoS 1 when you need to be sure that every message is sent and you have a system in place to handle duplicate messages. QoS 2 is the most reliable but (due to its nature) the slowest option, ensuring that every message is delivered exactly once.

Protocol

Select from JSON, XML, Sparkplug B, Pass Through, or Custom.

It is possible to configure the driver with one protocol, but then have an IO tag use a different protocol by specifying another Decoder in its address. Be aware that you cannot do Sparkplug communications unless the driver protocol is set to Sparkplug. You can use other protocols when in Sparkplug mode by specifying a Decoder in the address.

Enable Auto Rewrite

If selected, the Store Last Output Values option will also be activated. This option causes the driver to rewrite the last value written to each output, in the event that communications are lost, then restored.

Use this option only if you are certain that you want the last values to be rewritten automatically after an interruption in driver communications.

Store Last Output Values

When selected, the driver will maintain a record of the last value written to each output address. This may be useful in at least two situations:

  • For hardware that does not maintain its state during a power loss and must be restored to that state when re-started.
  • When failed hardware is replaced by a new device and you would like to start that device with the values last written to the old one.

If the last output values are stored, they may be re-written by either of two methods:

  • Automatically, when communication is restored to the device.
  • Manually by way of a button press. See, Rewrite Outputs Widget for details.

Changing this value from selected to deselected will cause all stored values to be erased immediately.

Hold

Select whether this driver should hold the last message received from the broker in the event of a communications failure.

Automatic Tag Creation Sparkplug B protocol only.

When selected, a hierarchy of Context and I/O tags will be created automatically under the driver tag whenever a BIRTH certificate is received.

After the tags are created, they can be modified as needed but should not be moved unless Automatic Tag Creation is disabled. Otherwise, new copies of the tags will be created in their place.

If using a Driver Multiplexer, the MQTT driver should not use the Automatic Tag Creation option since the I/O tags cannot be placed under the subordinate MQTT driver.

MQTT Client Driver properties Credentials tab

Use this tab to provide the user name and password if those are required to sign into the MQTT broker. (Not all brokers will require these.)

Username

The name required to sign in to the MQTT broker

Password

The password matching that user name. Passwords are never shown and are not stored in plain text. That said, security depends on ensuring that your link to the MQTT broker uses only a secure connection (TLS).

Hash Password with MD5

Select this option if the MQTT broker saves passwords using that algorithm. The password will be hashed before being sent to the broker.

MQTT Client Driver properties Last Will tab

This provides a mechanism for the broker to notify interested clients that the VTScada client has disconnected. For example, if you set the Last Will Message to "VTScada MQTT Client 1 has disconnected" and the Last Will Topic to be "VTScada/Client/1", then if your application disconnects from the broker for any reason, the broker will send all clients that have subscribed to the topic "VTScada/Client/1" a message saying " VTScada MQTT Client 1 has disconnected "

Last Will Topic

The topic should be specific to the device, although this is not mandatory. One way to do this is to include the device name as part of the topic.

Last Will Message

The information to be sent to the topic in the event of a disconnection. "Offline" is typical.

Last Will QoS

Specify the quality of service with which the Last Will should be sent. (See notes in the description of the Connection tab.)

Last Will Retain

Use a retained message to update the status of a device on a topic. New clients will see the last retained message.