network scan with python

volker
2014-02-13
2015-09-30
  • volker - 2014-02-13

    When I create a new project and click 'login', then I get a message box "No active path defined. Do you want to set it?".
    If I click "Yes", there is done a network scan, my device will be found and I can go online.
    How can I do this network scan in python?

    thank you

     
  • Anonymous - 2014-02-13

    Originally created by: M.Schaber

    Hi,

    You can set a network path and gateway via scripting, if you have that information, but currently, a network scan cannot be triggered by the scripting yet.

    The improvement CDS-24285 will implement that functionality, but it is not scheduled yet.

    If you want to influence the priority of this issue, you can use the usual channels (our support department for OEMs, your OEM for end-users) to increase it.

    HTH,
    Markus

     
  • etamgul - 2015-07-14

    My only problem with this that even if I know the installation-windows dependent GUID of the gateway I can not know the device ID since (even if the device is the same, with same firmware on the same IP) its changing from time to time.

    So hardcoding the GUID and "bus independent Codesys" address is not a solution.

    Any idea how to resolve this?

     
  • Anonymous - 2015-07-15

    Originally created by: M.Schaber

    Hi,

    Sadly, I don't have any good idea, that's why we did file the aforementioned improvement in our database.

     
  • etamgul - 2015-09-29

    Hi

    I recently updated to SP7 and noticed that some of my script are failing (either entering debug mode or at login).
    I'm still trying to figure out what went wrong but noticed a really strange behaviour in gateway setting:

    When using the graphical interface (Device/Gateway configuration) I can enter the address of the device manually or choose my device
    from the scan list. But seems there is a difference between these two. (Lets assume that I have a device with address '0003.2A0E.B0CA'.

    a) Choosing the device from the list with double click will result a green connection
    b) Entering manually the exact following string '0003.2A0E.B0CA' (without ofc '') will report me that there is no route to host
    c) Entering manually the exact following string '[0003.2A0E.B0CA]' will result a green connection
    d) Entering manually the exact following string '[0003.2A0E.B0CA] (active)' will result a green connection

    Since from scripting there is no way to scan and choose a device from a list, I'm manually trying to force the values using set_getway...(...) call.
    But this will result the same as I would have entered like point b).
    Giving the c) or d) format to this interface function results an 'Invalid address format' exception.

    Any idea whats wrong/changed/am I doing wrong with SP7?

     
  • Anonymous - 2015-09-30

    Originally created by: M.Schaber

    Hi, etamgul,

    etamgul hat geschrieben:
    Hi
    I recently updated to SP7 and noticed that some of my script are failing (either entering debug mode or at login).
    I'm still trying to figure out what went wrong but noticed a really strange behaviour in gateway setting:
    When using the graphical interface (Device/Gateway configuration) I can enter the address of the device manually or choose my device
    from the scan list. But seems there is a difference between these two. (Lets assume that I have a device with address '0003.2A0E.B0CA'.
    a) Choosing the device from the list with double click will result a green connection
    b) Entering manually the exact following string '0003.2A0E.B0CA' (without ofc '') will report me that there is no route to host
    c) Entering manually the exact following string '[0003.2A0E.B0CA]' will result a green connection
    d) Entering manually the exact following string '[0003.2A0E.B0CA] (active)' will result a green connection
    Since from scripting there is no way to scan and choose a device from a list, I'm manually trying to force the values using set_getway...(...) call.
    But this will result the same as I would have entered like point b).
    Giving the c) or d) format to this interface function results an 'Invalid address format' exception.
    Any idea whats wrong/changed/am I doing wrong with SP7?

    As far as I can see, there were no code changes in this area of scripting APIs in SP7.

    In the UI, you need to put the address between brackets "[1234]" to disambiguate them from names, for addresses like "AFFE". So putting in the address in Format b will try to search for a PLC with the string as the name.

    I think we could snip surrounding []s in the scripting API (to make it equally accept format b and c). Case D should not be accepted by the scripting API in my opinion.

    I can't tell why you don't get any connection using the script - this should be investigated and debugged, please contact e support@codesys.com e .

     

Log in to post a comment.