Programmatically enable/disable device connection

I have a similar need (not the same root cause, though). We have OMRON sensors that communicate with Ignition over TCP. Every few days, "something" glitches and they stop sending. The workaround is to Disable/Save and then Enable/Save those connections.

We have added a tag to detect the glitch (there is a timestamp embedded in the data packet from the sensor, so when that timestamp is stale, it means the device has stopped sending). When that tag reaches 2 minutes, we'll send out an alarm to an Ignition Admin.

But ... what we'd rather do is have that event trigger a script that would programmatically disable and enable the Device Connection.

Try this: system.device.setDeviceEnabled - Ignition User Manual 8.1 - Ignition Documentation

1 Like

I think we use system.device.restart - Ignition User Manual 8.1 - Ignition Documentation for a similar purpose.

:exploding_head:

I must have been on vacation or something when that got added.

2 Likes

I'll try it

Anybody got a good approach for parsing out a DeviceName from a tag's OPCItemPath? Looks like it is delimited with square-brackets ... I'll try something based on that definition.

nm: Split Regex expression to get tag OPCItemPath 'Device' name - Ignition - Inductive Automation Forum