Details about the MQTT Clients connected at Engine can be found in the Engine Info > MQTT Clients folder in the MQTT Engine tag provider where a tag path is created for each Server Setting configured
where:
Name | Data Type | Description |
---|---|---|
Connected Nodes | Integer | Number of currently connected Sparkplug Edge Nodes to this MQTT Client |
Enable Latency Check | Integer | Writable tag to enabled message latency checking for each MQTT Client |
Message Processing Latency (ms) | Integer | The amount of time to process the last Sparkplug message |
Messages Per Second | Integer | The number of MQTT messages received by Engine per second |
MQTT Client ID | String | The Client ID for the MQTT Client |
Offline DateTime | DateTime | The last time at which the MQTT Client successfully disconnected from the MQTT Server |
Online | Boolean | A read-only tag showing the connection status of the MQTT Client |
Online DateTime | DateTime | The last time at which the MQTT Client successfully connected to the MQTT Server |
Server Latency (ms) | Integer | The amount of time that it takes for a test MQTT message to be sent and received back by MQTT Engine |
Target Server URL | String | The URL of the target MQTT Server to connect to |
Executing the code below in the Ignition Script Console will print out the details for each MQTT Client for review:
clients = system.tag.browseTags(parentPath="[MQTT Engine]Engine Info/MQTT Clients", tagType="Folder", recursive=False) index = 0 count = 0 while index < len(clients): data = [] tagPath = str(clients[index]).split("/") data.append(["Server Name", tagPath[len(tagPath)-1]]) data.append(["MQTT Client ID", system.tag.readBlocking(str(clients[index]) + "/MQTT Client ID")[0].value]) data.append(["Online", system.tag.readBlocking(str(clients[index]) + "/Online")[0].value]) data.append(["Online DateTime", system.tag.readBlocking(str(clients[index]) + "/Online DateTime")[0].value]) data.append(["Primary Host ID", system.tag.readBlocking(str(clients[index]) + "/Primary Host ID")[0].value]) data.append(["Target Server URL", system.tag.readBlocking(str(clients[index]) + "/Target Server URL")[0].value]) data.append(["Number of Connected Sparkplug Edge Nodes", system.tag.readBlocking(str(clients[index]) + "/Connected Nodes")[0].value]) if system.tag.readBlocking(str(clients[index]) + "/Online")[0].value: count = count + 1 print data index = index + 1 print ("Number of MQTT Clients: " + str(len(clients))) print ("Number of connected MQTT Clients: " + str(count)) |
Example result from the Engine Info > MQTT Clients above
>>> [['Server Name', 'Chariot SCADA'], ['MQTT Client ID', u'ME-d631ab45-4466-42f0'], ['Online', True], ['Online DateTime', Tue Sep 26 08:58:59 CDT 2023], ['Primary Host ID', None], ['Target Server URL', u'tcp://localhost:1883'], ['Number of Connected Sparkplug Edge Nodes', 2]] [['Server Name', 'Second MQTT Server'], ['MQTT Client ID', u'ME-9a13f3b9-b9e4-4c6f'], ['Online', False], ['Online DateTime', None], ['Primary Host ID', None], ['Target Server URL', u'tcp://192.72.123.45:1883'], ['Number of Connected Sparkplug Edge Nodes', 0]] Number of MQTT Clients: 2 Number of connected MQTT Clients: 1 >>> |
For additional details on the connected Sparkplug Edge Nodes review How do I know how many Sparkplug EdgeNodes are connected at MQTT Engine |