The MQTT Sparkplug™ B specification defines a way for subscribing clients (such as MQTT Engine) to notify publishing clients (such as MQTT Transmission) via a STATE message when they are online or offline.
When the subscribing client connects to a server, it can publish its connection state on a topic that contains an ID identifying it as a critical application.
In the event that the subscribing client becomes disconnected from the server, the server will publish a LWT message on the same topic setting the state to offline. Any connecting client that subscribes on the state topic will then be notified of critical application state and can key off this to do different things when that subscriber status changes.
Prior to the v3.0.0 release of the specification, the STATE message included a UTF-8 string payload that was either ONLINE or OFFLINE. Sparkplug™ B payloads are not used for encoding in this payload and this allowed critical/backend application(s) to work across Sparkplug™ payload types.
From the V3.0.0 release of the specification, both the topic namespace and payload for the STATE message have been updated. The topic now includes a "namespace" element and the payload is a JSON data format comprising two name/value pairs of "online" and "timestamp".
From release 4.0.14 MQTT Engine will support the new STATE message format and be in compliance with MQTT Sparkplug™ B specification v3.0.0.
However as there will still be many existing clients which are only compatible with the MQTT Sparkplug™ B specification v2.2, we have made changes to MQTT Engine to establish a MQTT client whose only function to publish the STATE message in its legacy format. This is a configurable option and will be enabled as default.
For most customer this change will be seamless and no additional configuration is required.
However, if using MQTT Distributor you will see that the tag [MQTT Distributor]Distributor Info/Connected Clients has increased by one. If you have scripting or an application using this tag value, then you will likely need to make the appropriate changes to accommodate this increase in the connected client count.
When viewing Ignition logs, you will also notice a new MQTT Engine client which starts with ME-LS for example:
TahuClient 10Nov2022 17:13:31 ME-LS-6a6595d1-d44b-4: MQTT Client connected to tcp://localhost:1883 on thread Thread-2043
TahuClient 10Nov2022 17:13:31 ME-6ME-88477f61-7893-49b1: MQTT Client connected to tcp://localhost:1883 on thread Thread-2040
The additional legacy STATE client is configured under the Advanced section for each of the configured MQTT servers in MQTT Engine **** add link *** however for most customers there is no additional configuration required.
If you are updating from a previous version of MQTT engine to v4.0.14, the upgrade will automatically populate the Legacy State template with the variables from the server configuration Main and TLS sections.
For some MQTT servers, the Username/Password for each client connection must be unique and so these parameters may need to be edited |
To disable, you simply deselect the Enable Legacy STATE messages option.