Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An MQTT Client folder is available for each MQTT Transmission transmitter:

 


where:

Name

Data Type

Description

Command Latency (ms)LongThe amount of time for a test MQTT command message to be sent and received back by the MQTT Client 
Enable Latency CheckBooleanWriteable tag to enable command latency checking for each MQTT Client
MQTT Client IDStringThe Client ID for the MQTT Client
Offline DateTimeDateTimeThe last time at which the MQTT Client successfully disconnected from the MQTT Server
OnlineBooleanA read-only tag showing the connection status of the MQTT Client
OnlineDateTimeDateTimeThe last time at which the MQTT Client successfully connected to the MQTT Server
Primary Host IDStringThe Primary Host ID configured for this MQTT Client
Target Server URLStringThe 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
languagepy
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
languagepy
>>> 
[['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
languagepy
>>> 
[['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
CLD80:FAQ: Ignition Modules
CLD80:FAQ: Ignition Modules
nopaneltrue

...