Skip to main content
Version: 8.1

system.device.addDevice

This function is used in Python Scripting.

Description​

Adds a new device connection in Ignition. Accepts a dictionary of parameters to configure the connection. Acceptable parameters differ by device type: i.e., a Modbus/TCP connection requires a hostname and port, but a simulator doesn't require any parameters.

info

When using this function, the arguments MUST be passed in as keyword arguments.

Client Permission Restrictions​

Permission Type: Device Management

Client access to this scripting function is blocked to users that do not meet the role/zone requirements for the above permission type. This function is unaffected when run in the Gateway scope.

Syntax​

system.device.addDevice(deviceType, deviceName, deviceProps, [description])

Parameters​

TypeParameterDescription
StringdeviceTypeThe device driver type. Possible values are listed in the Device Types table below.
StringdeviceNameThe name that will be given to the new device connection.
Dictionary[String, Any]devicePropsA dictionary of device connection properties and values. Each deviceType has different properties, but most require at least a hostname. Keys in the dictionary are case-insensitive, spaces are omitted, and the names of the properties that appear when manually creating a device connection.
Stringdescription
New in 8.1.10
The description that will be given to the new device connection. [optional]

Returns​

Nothing

Scope​

Gateway, Vision Client, Perspective Session

Device Types​

The tables below represent Inductive Automation device types that can be created with this function. Some device types require manual configurations to become fully functional, such as loading configuration files or adding mapped entries. In these cases you won't be able to completely configure the device with this function alone. Those device types are marked with "(requires manual configuration)" in the table below.

In addition, this function can also add devices from 3rd party modules; you will need to supply the driver type, which the module developer will be able to provide.

Driver NameDevice Type
Allen-Bradley Logix DriverLogixDriver
Allen-Bradley Micro800com.inductiveautomation.Micro800DeviceType
Allen-Bradley MicroLogixMicroLogix
Allen-Bradley PLC5PLC5
Allen-Bradley SLCSLC
DNP3 Drivercom.inductiveautomation.Dnp3DeviceType
Legacy DNP3 DriverDnp3Driver
Legacy Allen-Bradley CompactLogixCompactLogix
Legacy Allen-Bradley ControlLogixControlLogix
Mitsubishi TCPcom.inductiveautomation.MitsubishiTcpDeviceType
Modbus RTUModbusRtu
Modbus RTU over TCPModbusRtuOverTcp
Modbus TCPModbusTcp
Omron FINS TCP
(requires manual configuration)
com.inductiveautomation.FinsTcpDeviceType
Omron FINS UDP
(requires manual configuration)
com.inductiveautomation.FinsUdpDeviceType
Omron NJ Drivercom.inductiveautomation.omron.NjDriver
IEC 61850 Drivercom.inductiveautomation.Iec61850DeviceType
Siemens S7-300S7300
Siemens S7-400S7400
Siemens S7-1200S71200
Siemens S7-1500S71500
Simulators Dairy Demo SimulatorDairyDemoSimulator
Simulators Generic SimulatorSimulator
Simulators SLC SimulatorSLCSimulator
TCP DriverTCPDriver
UDP DriverUDPDriver

Device Properties​

The deviceProps parameter is where you supply configuration values to the new connection. Value properties depend on which deviceType was specified. A listing of deviceProps keys can be found on the system.device.addDevice - deviceProps Listing page.

The keys in the deviceProps parameter are case-insensitive. Device properties not specified in the deviceProps parameter will fallback to default values if not specified (where applicable: i.e., "hostname" typically does not have a default value).

Code Examples​

Code Snippet - Creating a New Simulator Device
# Below is an example of creating a new Generic Simulator device connection.
# Note that we MUST pass a dictionary as the 3rd parameter, even if it's empty.

# Call the function
system.device.addDevice(deviceType = "Simulator", deviceName = "New_Generic_Simulator", deviceProps = {} )
Code Snippet - Creating a New Allen Bradley Logix Device
# Add a device using the Allen-Bradley Logix Driver for firmware v21+ devices
deviceProps = {}
deviceProps["Hostname"] = "192.168.1.2"
system.device.addDevice(deviceName="Test1", deviceType="LogixDriver", deviceProps=deviceProps)
Code Snippet - Creating a New Siemens Device
# Below is an example of creating a new S7-1500 device connection.

# Build a Dictionary of parameters
newProps = {
"HostName" : "10.0.0.1",
"Port" : 102 # <---If adding additional parameters, make sure to add a comma.
}

# Call the function
system.device.addDevice(deviceType = "S71500", \
deviceName = "My_S7_1500_Device",\
deviceProps = newProps )
New in 8.1.28
Code Snippet - Creating a New Device in a Disabled State
# Add a Simulator device in a disabled state

# Define your dictionary. This is where the device will know whether to be added in a disabled or enabled state.
# A value of 0 will add the device in a disabled state, while a value of 1 will add the device in an enabled state.
newProps = {
"Enabled" : 0
}

# Call the system function
system.device.addDevice(deviceType = "Simulator",
deviceName = "MySimDevice",
deviceProps = newProps)