# system.device.addDevice

**URL:** <https://forum.inductiveautomation.com/t/system-device-adddevice/14677>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [July 3, 2017, 2:45pm UTC](https://forum.inductiveautomation.com/t/system-device-adddevice/14677 "2017-07-03T14:45:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maidamar](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@maidamar](https://forum.inductiveautomation.com/u/maidamar)\
**Post date:** [July 3, 2017, 2:45pm UTC](https://forum.inductiveautomation.com/t/system-device-adddevice/14677/1 "2017-07-03T14:45:27Z")

</div>

According to [the documentation](https://docs.inductiveautomation.com:8443/display/DOC79/system.device.addDevice), this function accepts several parameters.  
When trying to add TCP devices with “Character Based” message delimiter type, I kept getting an exception:

```auto
>>> system.device.addDevice(driver="TCP", deviceName="test",messageDelimiterType='Character Based', hostname='127.0.0.1', ports='1000')
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Converting Character Based for [TCPDriverSettings null NewRecord Dirty1].[F TCPDriverSettings.MessageDelimiterType]

```

I found a different way to add the device with:  
`system.device.addDevice(deviceName='test', deviceType='TCPDriver', deviceProps=deviceProps)`  
and setting some options through the deviceProps dictionary.  
I could not find any documentation for what parameters I can use in this dictionary so I tried this and got lucky:

```auto
deviceProps={
	'Ports': '1000',
	'Address': '127.0.0.1'
	'MessageDelimiterType': 'CharacterBased',
	'MessageDelimiter': '\x03'
	}

```

Does anybody know a full description of this parameter? What does it accept and what does it not?

---

<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:** [July 3, 2017, 3:43pm UTC](https://forum.inductiveautomation.com/t/system-device-adddevice/14677/2 "2017-07-03T15:43:46Z")

</div>

I’m going to guess the values are driver-specific and correspond to the columns in that drivers settings table in the gateway’s internal database. In the raw settings viewer, this:

```auto
Select sql from sqlite_master where name='TCPDRIVERSETTINGS'

```

yields:

```auto
CREATE TABLE TCPDRIVERSETTINGS ( "DEVICESETTINGSID" NUMERIC(18,0) NOT NULL, "PORTS" VARCHAR(4096) NOT NULL, "ADDRESS" VARCHAR(4096) NOT NULL, "INACTIVITYTIMEOUT" INTEGER DEFAULT 0 NOT NULL, "MESSAGEDELIMITERTYPE" VARCHAR(1024) DEFAULT 'PacketBased', "MESSAGEDELIMITER" VARCHAR(4096), "FIELDCOUNT" INTEGER DEFAULT 0, "FIELDDELIMITER" VARCHAR(4096), "WRITEBACKENABLED" BOOLEAN DEFAULT 0, "WRITEBACKDELIMITER" VARCHAR(4096) DEFAULT '', CONSTRAINT PK_TCPDRIVERSETTINGS PRIMARY KEY (DEVICESETTINGSID) )

```

---

<div class="post-metadata">

**Author:** ![maidamar](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@maidamar](https://forum.inductiveautomation.com/u/maidamar)\
**Post date:** [July 3, 2017, 4:27pm UTC](https://forum.inductiveautomation.com/t/system-device-adddevice/14677/3 "2017-07-03T16:27:08Z")

</div>

Ok, that’s some nice reverse engineering. 🕶  
Still those are the column names of the table, but I don’t know the mapping from the `deviceProps` dictionary to those columns.  
Also, following your idea, I took a look at the “`DeviceSettings`” table and found `DESCRIPTION` and `ENABLED` there, but could not find the mapping from the `addDevice` parameters to those columns.  
Still, thanks for your input, interesting way of finding out the innerworkings of Ignition.

---

<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:** [July 3, 2017, 5:32pm UTC](https://forum.inductiveautomation.com/t/system-device-adddevice/14677/4 "2017-07-03T17:32:16Z")

</div>

Not that I’m allowed to condone this, but you actually want ‘TCPDRIVERSETTINGS’ in the IDB in this case.

That said, it looks like there’s a bug with the addDevice function (which isn’t surprising):

```auto
system.device.addDevice(
	driver="tcp",
	deviceName="test124",
	messageDelimiterType="Character Based",
	hostname='127.0.0.1', 
	ports='1000')

```

Throws an error `GatewayException: Converting Character Based for [TCPDriverSettings null NewRecord Dirty1].[F TCPDriverSettings.MessageDelimiterType]`, but does successfully create a ‘Packet Based’ device on the gateway.

I’ve filed an internal ticket to get this looked at.

---

<div class="post-metadata">

**Author:** ![maidamar](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@maidamar](https://forum.inductiveautomation.com/u/maidamar)\
**Post date:** [July 3, 2017, 5:49pm UTC](https://forum.inductiveautomation.com/t/system-device-adddevice/14677/5 "2017-07-03T17:49:46Z")

</div>

> [@paul-griffith](#):
>
> I've filed an internal ticket to get this looked at.

Great, thank you for that. Would you mind adding to the ticket that there is no way of modifying the Description of the device from the addDevice function as well?

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [October 29, 2018, 11:47am UTC](https://forum.inductiveautomation.com/t/system-device-adddevice/14677/6 "2018-10-29T11:47:16Z")

</div>

@paul-griffith,  
About the **system.device.addDevice** , it would every usefull if you can add the device description parameter !
