Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Get Deviceaddress of CPU via Python an Login via Test Manager

2017-03-14
2017-03-14
  • Sebastian-abb - 2017-03-14

    Hello,
    I have a question and i hope you can help me. I want to use Python (see Code below) to get the deviceadress of my CPU an than use this address to login into the CPU via the Test Manager.

    If i use the code i get the right information out of the CPU but if i try to use " deviceaddress " out of Pythonscript in my Testscript, the Testmanager says the Format is invalid.
    Is this error because the Address is of type "string", or do i have to use a other way to get the address out of the script?

    Best regards

    Sebastian

    \# Find device object
    found = projects.primary.find('PLC_AC500_V3',True) #('PLC_7', True)
    assert(found and len(found) == 1, 'No or more than one device found')
    dev = found[0]
    \#print (dev)
    \# ==============Β  Find gateway
    gw = online.gateways['Gateway-1']
    deviceidΒ  Β  Β  = dev.get_device_identification()
    \#print (deviceid)
    devicegateway = dev.get_gateway()
    \#print (devicegateway)
    deviceaddress = dev.get_address()
    print (deviceaddress)Β  # => Output 03C8.9000.2DDC.C0A8.090B
    print 'type',type(deviceaddress)
    
     
  • mkeller - 2017-03-14

    Hi Sebastian.

    Sebastian_abb hat geschrieben:
    Hello,
    I have a question and i hope you can help me. I want to use Python (see Code below) to get the deviceadress of my CPU an than use this address to login into the CPU via the Test Manager.
    If i use the code i get the right information out of the CPU but if i try to use " deviceaddress " out of Pythonscript in my Testscript, the Testmanager says the Format is invalid.
    Is this error because the Address is of type "string", or do i have to use a other way to get the address out of the script?

    For what reason do you want to get the device address through the Scripting and use it to login through the Test Manager?

    If the communication path for the device is already configured then you can just login with your test script. If you want to use the Scripting API for the gateways to scan the network and find a suitable device then you can just configure the communication path through Scripting and also just login in the test script.

    BR
    Martin

     
  • Sebastian-abb - 2017-03-14

    Hi Martin,

    thanks for the quick answer. I need the address because I use Unit TestΒ΄s with the Testmanager and for this Type of test the Testmanager needs the Deviceaddress. The second reason is that i work with the Automation Builder from ABB and with different versions of the Automationbuilder the deviceaddress changes and so i have to read it out with every Version i use my test on.

    Best regards
    Sebastian

     

Log in to post a comment.