# Adding device address through script

**URL:** <https://forum.inductiveautomation.com/t/adding-device-address-through-script/97854>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [October 28, 2024, 8:16pm UTC](https://forum.inductiveautomation.com/t/adding-device-address-through-script/97854 "2024-10-28T20:16:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammad\_Saim](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Muhammad\_Saim](https://forum.inductiveautomation.com/u/Muhammad_Saim)\
**Post date:** [October 28, 2024, 8:16pm UTC](https://forum.inductiveautomation.com/t/adding-device-address-through-script/97854/1 "2024-10-28T20:16:44Z")

</div>

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

```python
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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/c/bcfaa67da7154dd2b110abcfc0fb1079dd7dacc5.png)

Thank You!

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [October 28, 2024, 8:21pm UTC](https://forum.inductiveautomation.com/t/adding-device-address-through-script/97854/2 "2024-10-28T20:21:40Z")

</div>

My advice: don't.

Don't use the mapping feature.

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

[![](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/4/149e2dd9ee1b03707f7f00648794417a79d1a645.jpeg "add tags from vision client demo ignition 7.9") ](https://www.youtube.com/watch?v=mYPxcihFVnA)

---

<div class="post-metadata">

**Author:** ![Muhammad\_Saim](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Muhammad\_Saim](https://forum.inductiveautomation.com/u/Muhammad_Saim)\
**Post date:** [October 28, 2024, 8:34pm UTC](https://forum.inductiveautomation.com/t/adding-device-address-through-script/97854/3 "2024-10-28T20:34:29Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/6/d63cac7d19a17f67a01727ead90508fc54ace0fb.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 28, 2024, 8:37pm UTC](https://forum.inductiveautomation.com/t/adding-device-address-through-script/97854/4 "2024-10-28T20:37:21Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![Muhammad\_Saim](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Muhammad\_Saim](https://forum.inductiveautomation.com/u/Muhammad_Saim)\
**Post date:** [October 28, 2024, 8:57pm UTC](https://forum.inductiveautomation.com/t/adding-device-address-through-script/97854/5 "2024-10-28T20:57:49Z")

</div>

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](https://us1.discourse-cdn.com/inductiveautomation/optimized/3X/3/2/326fc4a1227689fe1caf77c318c87e92e0ca31b8_2_690x49.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 28, 2024, 9:03pm UTC](https://forum.inductiveautomation.com/t/adding-device-address-through-script/97854/6 "2024-10-28T21:03:15Z")

</div>

> **[Modbus Addressing | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/opc-ua/opc-ua-drivers/modbus/modbus-addressing#manually-addressing-a-modbus-device)**
>
> Manually Addressing a Modbus Device
