Check Device Connection Status Via Scripting

Unusual application where I am retrieving all PLC values from multiple PLCs using scripting and system.opc.readValues() rather than setting up individual OPC tags due to dynamic polling rates. Is there any way to check an individual device connection Status=Connected before calling syste.opc.readValues() in order to skip devices that are subject to being powered off at any given time ? All connections are A-B devices (CompactLogix and MicroLogix) using Ignition OPC-UA Server.

Ignition 8.0.12

Thanks In Advance

1 Like

One way: system.device.listDevices()

Another path:

[System]Gateway/Devices/DeviceName/Status

Third way (and best, IMO): use a heartbeat.

Thanks Jordan - In my haste to try to correct the issue onsite I saw the system.device.listDevices() but incorrectly assumed that is merely provided a list of the devices and neglected to dive deeper to see that it also returns the dataset including device status.

BTW - I am using a heartbeat bit at the PLC level to not only determine that Comms are OK but also that the PLC logic is actively running - but I can’t check it until I complete the system.opc.ReadItems()

Much appreciated …