Contents
Cirrus Link Resources
Cirrus Link Website
Contact Us (Sales/Support)
Forum
Cirrus Link Modules Docs for Ignition 7.9.x
Inductive Resources
Ignition User Manual
Knowledge Base Articles
Inductive University
Forum
...
Executing the code below in the Ignition Script Console will print out the values in the MQTT Clients dataset for review:
Code Block | ||
---|---|---|
| ||
print ("Number of Connected Clients: " + str(system.tag.readBlocking("[MQTT Distributor]Distributor Info/Connected Clients")[0].value)) print ("Keep Inactive Clients: " + str(system.tag.readBlocking("[MQTT Distributor]Distributor Info/Keep Inactive Clients")[0].value)) print ("Total clients that have connected since last MQTT Distributor restart: " + str(system.tag.readBlocking("[MQTT Distributor]Distributor Info/Total Clients")[0].value)) clients = system.dataset.toPyDataSet(system.tag.readBlocking("[MQTT Distributor]Distributor Info/MQTT Clients")[0].value) print ("MQTT Client details:") for row in clients: data = clientId =[] data.append(["Client ID", row[0]]) data.append(["Username", row["Username"]]) data.append(["IP Address", userName =row["IP Address"]]) data.append(["Connected", row["UsernameConnected"]]) data.append(["Last Connect Time", row["Last Connect ipAddress =Time"]]) data.append(["Last Disconnect Time", row["IPLast Disconnect AddressTime"]]) print data |
Example result from the Distributor Info > MQTT Clients
Code Block |
---|
>>> Number of Connected Clients: 4 Keep Inactive Clients: True Total clients that have connected = row["Connected"] lastConnectTime = row["Last Connect Time"] lastDisconnectTime = row["Last Disconnect Time"] print clientId, userName, ipAddress, connected, lastConnectTime, lastDisconnectTime |
Example result for two connected clients
Code Block | ||
---|---|---|
| ||
>>> ME-d631ab45-4466-42f0 admin since last MQTT Distributor restart: 6 MQTT Client details: [['Client ID', u'MT-abf45d02-4c23-4489'], ['Username', u'admin'], ['IP Address', u'127.0.0.1'], ['Connected', False], ['Last Connect Time', Fri Sep 22 16:01:43 CDT 2023], ['Last Disconnect Time', Fri Sep 22 16:04:32 CDT 2023]] [['Client ID', u'ME-d631ab45-4466-42f0'], ['Username', u'admin'], ['IP Address', u'127.0.0.1'], ['Connected', True], ['Last Connect Time', Fri Sep 22 16:01:42 CDT 2023], ['Last Disconnect Time', None]] [['Client ID', u'MT-6697e6f5-35fe-471f'], ['Username', u'admin'], ['IP Address', u'127.0.0.1'], ['Connected', True], ['Last Connect Time', Fri Sep 22 16:04:34 CDT 2023], ['Last Disconnect Time', None]] [['Client ID', u'MT-12c7ca46-e2ec-416c'], ['Username', u'admin'], ['IP Address', u'127.0.0.1'], ['Connected', False], ['Last Connect Time', Fri Sep 22 16:01:43 CDT 2023], ['Last Disconnect Time', Fri Sep 22 16:04:32 CDT 2023]] [['Client ID', u'MT-04edd7b9-b7ad-455d'], ['Username', u'admin'], ['IP Address', u'127.0.0.1'], ['Connected', True], ['Last Connect Time', Fri Sep 22 0916:4504:0334 CDT 2023], ['Last Disconnect Time', None]] [['Client ID', u'MT-RPC-1693f8e573ecfe46-014a-4609 admin 2a63-41'], ['Username', u'admin'], ['IP Address', u'127.0.0.1'], ['Connected', True], ['Last Connect Time', Fri Sep 22 1016:04:2032 CDT 2023 None >>>], ['Last Disconnect Time', Fri Sep 22 16:04:32 CDT 2023]] >>> |
MQTT Engine has two potential client connections per MQTT Server setting.
One, with ClientId in the format ME-xxxxxxx-xxxx-xxxx, will publish the v3.0.0 Sparkplug™ B STATE message which will be initiated by default.
A second optional client, with ClientId in the format ME-LS-xxxxxxxx-xxxx-xx, is available to publish the legacy Sparkplug™ B STATE message and is disabled by default.
Tip |
---|
See How do I know how many MQTT Clients are connected from MQTT Engine for additional information |
Each Sparkplug Edge Node Descriptor (which is the Group ID and Edge Node ID combination) will create an MQTT client.
...
In addition, MQTT Transmission supports an optional RPC Client, ClientId MT-RPC-xxxxxxxx-xxxx-xxxx, which is used when publishing from Ignition Python scripts. This is enabled by default.
Tip |
---|
See How do I know how many MQTT clients are connected from MQTT Transmission for additional information |
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
...