![]()
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![]()
...
An MQTT Client folder is available for each MQTT Transmission transmitter:
where:
Name | Data Type | Description |
|---|---|---|
| Command Latency (ms) | Long | The amount of time for a test MQTT command message to be sent and received back by the MQTT Client |
| Enable Latency Check | Boolean | Writeable tag to enable command latency checking for each MQTT Client |
| 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 |
| OnlineDateTime | DateTime | The last time at which the MQTT Client successfully connected to the MQTT Server |
| Primary Host ID | String | The Primary Host ID configured for this MQTT Client |
| 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 values in the MQTT Client folder for review:
| Code Block | ||
|---|---|---|
| ||
clients = system.tag.browseTags(parentPath="[MQTT Transmission]Transmission Info", tagPath="*MQTT Client", recursive=True) index = 0 printcount ("Number of MQTT Clients: " + str(len(clients)))= 0 while index < len(clients): data = [] tagPath = str(clients[index]).split("/") data.append(["Sparkplug EdgeNode Descriptor",tagPath[len(tagPath)-3],tagPath[len(tagPath)-2]]) 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(["Offline DateTime", system.tag.readBlocking(str(clients[index]) + "/Offline DateTime")[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 results Example result from the Transmission > Info > Transmitters above
| Code Block | ||
|---|---|---|
| ||
>>> [['Sparkplug EdgeNode Descriptor', 'G1', 'E1'], ['MQTT Client ID', u'MT-a9502db1-a649-40e6'], ['Online', True], ['Online DateTime', Tue Sep 26 08:58:05 CDT 2023], ['Primary Host ID', u'IamHost'], ['Target Server URL', u'tcp://localhost:1883'], ['Offline DateTime', Tue Sep 26 08:56:44 CDT 2023]] [['Sparkplug EdgeNode Descriptor', 'MyGroup', 'MyEdgeNode'], ['MQTT Client ID', u'MT-1d624cea-c810-40e0'], ['Online', True], ['Online DateTime', Tue Sep 26 08:58:04 CDT 2023], ['Primary Host ID', u'IamHost'], ['Target Server URL', u'tcp://localhost:1883'], ['Offline DateTime', Tue Sep 26 08:56:44 CDT 2023]] Number of MQTT Clients: 2 Number of connected MQTT Clients: 2 >>> |
| Code Block | ||
|---|---|---|
| ||
>>> [['Sparkplug EdgeNode Descriptor', 'G1', 'E1'], ['MQTT Client ID', u'MT-233770eca9502db1-fa46a649-46f240e6'], ['Online', TrueFalse], ['Online DateTime', FriTue Sep 2226 1108:5658:1705 CDT 2023], ['Primary Host ID', u'IamHost'], ['Target Server URL', u'tcp://localhost:1883'], ['Offline DateTime', None Tue Sep 26 08:58:53 CDT 2023]] [['Sparkplug EdgeNode Descriptor', 'MyGroup', 'MyEdgeNode'], ['MQTT Client ID', u'MT-c53831be1d624cea-ce8dc810-43f440e0'], ['Online', TrueFalse], ['Online DateTime', FriTue Sep 2226 1108:5658:1704 CDT 2023], ['Primary Host ID', u'IamHost'], ['Target Server URL', u'tcp://localhost:1883'], ['Offline DateTime', None]] Tue Sep 26 08:58:53 CDT 2023]] Number of MQTT Clients: 2 Number of connected MQTT Clients: 0 >>> |
| Excerpt Include | ||||||
|---|---|---|---|---|---|---|
|
...