Adding device address through script

Hello

I was able to use the default code to setup a device but I need some way of setting the addresses after the device is setup

newProps = {
            "HostName" : "10.165.220.15",
            "Port" : 502
            }

system.device.addDevice(deviceType = "ModbusTcp", \
                        deviceName = "My_S7_1500_Device",\
                        deviceProps = newProps)

I'm trying to add a row for Prefix, Start, End, Step, Unit ID, Modbus Type, Modbus Address programmatically

Thank You!

My advice: don't.

Don't use the mapping feature.

Create a script to add the tags, with OPC paths, instead.

3 Likes

I'm kinda confused because in ignition edge the tags don't show up in the opc browser without the addresses being added

MOD2 and Something are set to the same IP device but MOD2 has tags under unitId 5 but Something has no tags

Not all protocols are browsable--Modbus is one of them. IA decided to only support browse through the Address Mapping tool. Browsing is not required to make OPC tags in Ignition, and using the address mapping tools hasn't been recommended for some years now.

(If you really want Modbus browsing without making a mess of your OPC Item paths, look at my alternate Modbus driver.)

How would you know what the opc item path should be? Is there a pattern

With Registers: ns=1;s=[MOD2]5.MOD2116
Without Registers: ns=1;s=[Something]5.Something116

It doesn't seem to be the same pattern even though I can't browse

image