I have (assumably) 2 identical setups of CDS 3.5 SP7.
Previously I was configuring the gateway on the first machine with the following code:
    gateway_guid='3261a15d-434d-4868-9e1f-1bfa38e92408';#HARDCODED_VALUE,gateway_guid=self.device.get_gateway()    gateway_dev_addr=device_address  #HARDCODED_VALUE      log.debug('Gateway {} set with GUID: {}'.format(str(gateway_guid),str(gateway_dev_addr)));    self.device.set_gateway_and_address(gateway_guid,gateway_dev_addr);
Now that I have a 2nd machine, I wanted to check if it is still working and I got the error:
I thought the GUID has changed so I modified to code to use the get_gateway method and suprisingly that gave the exact same GUID,
and along with it, the result is also the same.
No matter whether I use the harcoded or the 'dynamic' way, on my 2nd machine I get the above exception.
Any idea what could be wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With CODESYS V3.5 SP8 we introducted a much better API for handling gateways and addresses. You can add, configure, find and remove gateways and also scan the network for available devices.
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oh it works now (I tried what you suggested but by itself setting once the gateway is not enough).
I had to set the project file to save the network settings, save the project and then the gateway guid I got previously turned to be valid.
So until one checks that save parameter option in a project and configures the gateway at least once,
no matter whether the gateway guid is valid, codesys scripting will throw this exception
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
defprintGatewayDriver(drv):
  print("BEGIN")
  print("GW driver: {} Guid={}".format(drv.name, drv.guid))
  forparamindrv.gateway_parameters:
    print("Id={} Name={} Desc.={} ParamType={} DefaultValue={}".format(param.id, param.name, param.description, param.parameter_type, param.default_value))
  print("END")
 Â
print("------ Available gateway drivers -----")fordrvinonline.gateway_drivers:
  printGatewayDriver(drv)
print all gateway parameters for the TCP/IP driver:
I have (assumably) 2 identical setups of CDS 3.5 SP7.
Previously I was configuring the gateway on the first machine with the following code:
Now that I have a 2nd machine, I wanted to check if it is still working and I got the error:
I thought the GUID has changed so I modified to code to use the get_gateway method and suprisingly that gave the exact same GUID,
and along with it, the result is also the same.
No matter whether I use the harcoded or the 'dynamic' way, on my 2nd machine I get the above exception.
Any idea what could be wrong?
Hi etamgul.
Getting the gatewayPath in codesys.
With CODESYS V3.5 SP8 we introducted a much better API for handling gateways and addresses. You can add, configure, find and remove gateways and also scan the network for available devices.
BR
Martin
Oh it works now (I tried what you suggested but by itself setting once the gateway is not enough).
I had to set the project file to save the network settings, save the project and then the gateway guid I got previously turned to be valid.
So until one checks that save parameter option in a project and configures the gateway at least once,
no matter whether the gateway guid is valid, codesys scripting will throw this exception
Could some please post an example about how to set the gateway with new API available in CODESYS V3.5.8.0.
I have seen in the online help that there are some interface (IScriptGateways & IScriptGateway) available.
But I do not know how to use them.
Thanks.
Originally created by: M.Schaber
Hi,
Here are some snippets using the new functions:
Configuring a device via gateway name and device IP addres:
printing all available gateway drivers:
print all gateway parameters for the TCP/IP driver:
Adding a new gateway:
HTH,
Markus