Get and Set Device Port Number Through Scripting

Is there a way to get and set a device port number similar to system.device.getDeviceHostname and system.device.setDeviceHostname? In particular, for the Allen-Bradley Logix Driver. I'm fine extending the system functions with a custom module, but I'm also having trouble finding the class/methods in the Java API to do this.

You cannot. Those are private to the driver. What you can do is delete the device instance and re-create it with the desired settings. (See my spreadsheet import tool on the exchange for code examples.)

{Technically, you could write into the internal configuration database with the right column name and value. There be dragons--a non-zero chance of crashing/freezing your gateway.}

(If you want to minimize the chance of dragons, you're likely better off writing to a backup and then restoring the gateway from snapshot, but even then you need to be careful about it. I've got a fair number of internal tools for it)

It's probably tiring to hear me talk about things that will be solved in 8.3... but this entire category of problem is solved in 8.3.

All the config of all the things is completely accessible through the REST API.

2 Likes

Since this will hopefully :folded_hands: :folded_hands: :folded_hands: be coming out soon, I'll just wait and implement a solution using 8.3. Thanks everyone!