Vision device status table

Hi All.

I have a mixture of OPC-UA devices, Siemens PLCs and AB PLCs. I would like to create a table showing the IP and connection status of all Ethernet devices connected to my ignition server. This could be very similar to Status\Connection\Devices and Status\Connections\OPC Connections on the ignition web server.

This following could be modified to write to a dataset or SQL table. I think I would have to pre-populate the dataset with the device description (for OPC-UA) and the IP. Can anyone think of a better way? It seems like this data is already inside ignition somewhere.

# OPC-UA servers
opcDevs = ['MCM-DATA1','MCM-MT4000A']
for device in opcDevs:
	tagPath= '[System]Gateway/OPC/Connections/' + device + '/connected'
	connected = system.tag.read(tagPath).value
	if connected:
		print device + " " + "connected"
	else:
		print device + " " + "disconnected"
# Other ethernet devices
otherDevs = ['LJF-Schaefer','STS-HeatTreatment']
for device in otherDevs:
	tagPath = '[System]Gateway/Devices/' + device + '/Status' 
	descPath = '[System]Gateway/Devices/' + device + '/Description' 
	desc = system.tag.read(descPath).value
	connected = system.tag.read(tagPath).value
	x = connected.find("Connected")
	if x <> -1:
		connStatus = "connected"
	else:
		connStatus = "disconnected"
		
	print device + "-" + desc + "-" +  connStatus

Best regards

Consider using system.device.listDevices() in a gateway timer script, writing the result to a gateway memory tag. That will do the majority of the work for you.

4 Likes

Thanks Phil. This works well. In addition, I have just tested system.opc.getServers() and system.opc.getServerState() for my OPC-UA devices.