How to ioDevicesItem = sysMan.LookupTreeItem("TIID") # Get the IO Devices Node scannedXml = ioDevicesItem.ProduceXml(False) # Produce Xml implicitly starts the ScanDevices on thi s node xmlDoc = ET.fromstring(scannedXml) # Loads the Xml data into an XML Document xmlDeviceList = xmlDoc.findall("./DeviceGrpDef/FoundDevices/Device") devices = [] # Container to store Scanned devices deviceCount = 0 # Add the Scanned devices for device in xmlDeviceList:
typeName = device.findtext("ItemSubTypeName") itemSubType = device.findtext("ItemSubType") xmlAddress = device.find("AddressInfo") deviceCount = deviceCount + 1; device = ioDevicesItem.CreateChild("Device_" + str(deviceCount) + typeName, itemSubType,"",No ne) xml = " " + ET.tostring(xmlAddress) + " " device.ConsumeXml(xml); # Consumes Xml Parameters (here the Address of the Device) devices.append(device); for device in devices: xml = " true " try: print device.ConsumeXml(xml) # Consumes starts the ScanBoxes and inserts every found box/ Terminal into the config except: print "Scan Failed!" for box in device:
print box.Name 8.14 How to add routes to a remote ADS device Adding ADS routes via the Automation Interface can be achieved by using the ConsumeXml() method. However, it is important to understand the underlying XML structure before adding routes to a remote target. XML structure The following snippet is a sample XML structure for adding routes to a remote target. Please note that you can either specify the IP address or the hostname of the remote target. Route Settings TIRR true RouteName 1.2.3.4.5.6 1.2.3.4 hostName userName password LocalName Automation Interface 79 Version: 1.2