Search code examples
pythonindustrial

Write single attribute in EtherNet/IP


My question will be about Cpppo and EtherNET/IP. I have installed the library Cpppo via pip and trying to set single value in certain class, but i'm doing something wrong, cause every time I am getting "NONE". My test code is:

from cpppo.server.enip.get_attribute import proxy_simple

via = proxy_simple( '192.168.100.7')
with via:
    result, = via.write( [('@0x7F/1/1 = (INT)1')], 1) 

Also I used Wireshark to get info about service and found, that service value is 0x4D, but in my case I need 0x10. Is it possible to make such kind of request using Cpppo library? Screenshot from Wireshark program
enter image description here
P.S. I'm sorry if my question was very stupid. Best wishes.


Solution

  • After one day and a half I found right way how to write single attribute in certain class using Cpppo library. I hope, that my solution will helps to someone. This code works with my hardware in right way:

    from cpppo.server.enip.get_attribute import proxy_simple
    
    via = proxy_simple('192.168.100.11')
    with via:
        result, = via.read([('@0x7F/1/1=(SINT)1','@0x7F/1/1')],1)
    

    And there is screenshot from Wireshark image