# Issues with system.device.addDevice script

**URL:** <https://forum.inductiveautomation.com/t/issues-with-system-device-adddevice-script/75365>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [June 21, 2023, 10:00pm UTC](https://forum.inductiveautomation.com/t/issues-with-system-device-adddevice-script/75365 "2023-06-21T22:00:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacob\_Barlow](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@Jacob\_Barlow](https://forum.inductiveautomation.com/u/Jacob_Barlow)\
**Post date:** [June 21, 2023, 10:00pm UTC](https://forum.inductiveautomation.com/t/issues-with-system-device-adddevice-script/75365/1 "2023-06-21T22:00:31Z")

</div>

Hey all,

I'm hoping this will be a simple fix, but I'm using the following script with a list of device names and IP addresses:

```auto
> deviceType = "ModbusTcp"
> 
> for i in range(len(trackers)):
> deviceName = str(trackers[i])
> deviceProps = {'Enabled': 1, 'HostName': str(ips[i]), 'Port':"502"}
> 	
> system.device.addDevice(deviceType, deviceName, deviceProps)

```

I checked the manual and I pulled a list of devices from my gateway and copied the deviceType/driver string exactly from the other modbus tcp devices in case I fat fingered something but no luck.

The error returned is a bunch of java stuff but the gist seems to be this:

> com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Device driver 'MODBUSTCP' doesn't exist

Which makes no sense, but maybe the driver name is different from how I'm typing it or something. Appreciate any ideas, thanks folks.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 21, 2023, 10:03pm UTC](https://forum.inductiveautomation.com/t/issues-with-system-device-adddevice-script/75365/2 "2023-06-21T22:03:50Z")

</div>

Try specifying the parameter names. There's some legacy baggage on this function that makes it complicated.

So something like this:

```python
deviceType = "ModbusTcp"
 
for i in range(len(trackers)):
 	deviceName = str(trackers[i])
 	deviceProps = {'Enabled': 1, 'HostName': str(ips[i]), 'Port':"502"}
 	
 	system.device.addDevice(deviceType=deviceType, deviceName=deviceName, deviceProps=deviceProps)

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 21, 2023, 10:05pm UTC](https://forum.inductiveautomation.com/t/issues-with-system-device-adddevice-script/75365/3 "2023-06-21T22:05:16Z")

</div>

Also, you can write your code a bit cleaner using the `zip` function:

```python
deviceType = "ModbusTcp"
 
for deviceName, hostName in zip(trackers, ips):
 	deviceProps = {'Enabled': True, 'HostName': hostName, 'Port': "502"}
 	
 	system.device.addDevice(deviceType=deviceType, deviceName=deviceName, deviceProps=deviceProps)

```

---

<div class="post-metadata">

**Author:** ![Jacob\_Barlow](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@Jacob\_Barlow](https://forum.inductiveautomation.com/u/Jacob_Barlow)\
**Post date:** [June 21, 2023, 10:05pm UTC](https://forum.inductiveautomation.com/t/issues-with-system-device-adddevice-script/75365/4 "2023-06-21T22:05:47Z")

</div>

Weird, that did it though. Definitely should have tried that but the error threw me down a rabbit hole that led nowhere productive. Thanks again.

---

<div class="post-metadata">

**Author:** ![Jacob\_Barlow](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@Jacob\_Barlow](https://forum.inductiveautomation.com/u/Jacob_Barlow)\
**Post date:** [June 21, 2023, 10:06pm UTC](https://forum.inductiveautomation.com/t/issues-with-system-device-adddevice-script/75365/5 "2023-06-21T22:06:30Z")

</div>

Fancy. I'm very much a self-taught noob when it comes to all the Ignition functionality so I appreciate the tip 🙂
