Python scripts: scanning and adding of I/O cards

2023-04-27
2023-05-01
  • ooantoinegfdfdg - 2023-04-27

    Hello!

    On the Codesys software, I would like to automate the configuration and the following tasks via a Python script (that is, searching for input-output cards, and then adding them to the current project). I am not really able to identify the functions that would allow me to do this. Attached are screenshots showing the steps that I would like to automate via a Python script.

    Thank you very much in advance for your help.

    Best regards,

     
  • snhatton - 2023-04-28

    Hello,

    Please take a look at the scripting engine reference documentation:

    https://help.codesys.com/webapp/ScriptDeviceObject;product=ScriptEngine;version=3.5.17.0

    There are methods described here that allow you to add, update, plug, insert, etc. device objects. Of course, you will need to know and provide the identify information of the type of device you are trying to add, however, this should get you started. Please let me know if you have any more questions or concerns.

    Thanks!

    -Shawn

     
  • ooantoinegfdfdg - 2023-05-01

    Hello Shawn!

    Thank you very much for your answer!

    Do you mean we won't be able to add some device objects to our project without knowing anything about them and just after a scanning?

    Inside the Scriptengine documentation, we found a function called perform_network_scan() which might be used from a gateway. Could it be used for what we wish to do?

    Can the Python scripts only allow us to browse through the objects within the project?

    Thank you very much in advance for your answer!

    Best regards,

     

    Last edit: ooantoinegfdfdg 2023-05-02

Log in to post a comment.