Does CoDeSys provide the possibility to set the gateway (e.g. IP number) and scan the network for devices, by python script.
In the examples, I see no gateway IP number at all. While in the GUI, I have to select a gateway and set the active path.
# set "Python.project" to active application
app = proj.active_application
onlineapp = online.create_online_application(app)
# login to device
The goal is to give a script two parameters (project name and gateway IP number). And that script would download the project to that device. (The project itself does not contain the gateway information.)
For scripts, device Objects have the following methods:
get_gateway() # Returns the Guid of the Gateway
get_address() # Returns the device address as a string.
set_gateway_and_address(gateway, address) # Sets the gateway and address for this device. (gateway can be a Guid object or the string representation of a Guid.)
So you can set the gateway and address CoDeSys uses to connect to a specific device, the "active path". The adress here is the CoDeSys address (like "[011D.8001.9ED4]") and not an IP address, as it has to cover routing through several cascaded field busses.
Sadly, the Guid is not yet displayed anywhere in the UI. The easiest way to get the Guid for a Gateway currently is to set the active path of a device to that gateway, and then dump it via "print projects.primary.find("name_of_device", True).get_gateway()" in a script.
It is not yet possible to configure the list of available Gateways itsself (like the "Add Gateway" button) from the script, however. If you need this functionality, please file it as a requirement via our support department.
Check out the CODESYS store: http://store.codesys.com/CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions