Code Monkey home page Code Monkey logo

Comments (5)

jpautomation avatar jpautomation commented on July 20, 2024

Answering my own question..

Yes you can.

What threw me was that a product na,e of "1756-EN2TR" is reported from the Identity query not the CPU part number but reading a tag from the ethernet module IP address still works

from cpppo.

jpautomation avatar jpautomation commented on July 20, 2024

Ok wonder if someone can help me here. ]

I can read tags fine with the client.connector.parse_operations with:

host = "192.168.1.5"     # Controller IP address
tags = [ "TestTag_DINT" ,"dummy", "TestString2[1-10]" ]
with client.connector( host=host ) as conn:
    for index,descr,op,reply,status,value in conn.pipeline(
            operations=client.parse_operations( tags ), depth=2 ):
        print( "%s: %20s: %s" % ( time.ctime(), descr, value ))

but when I use connector,read:

value = conn.read ("TestTag_DINT")

I just get the attributes of the tag returned to value.

And when I try to write it doesn't change the tag value:

req1 = conn.write( "TestTag_DINT", data=1234 )

What am I doing wrong. Tags are read/write and can be changed from Studio 5000.

Any help appreciated. Thanks in advance

from cpppo.

pjkundert avatar pjkundert commented on July 20, 2024

I would recommend using the cpppo.server.enip.get_attribute "proxy" API. The cpppo.server.enip.client "connector" API is very low-level; it is designed for issuing and harvesting a stream of requests to/from a device, in a pipelined fashion. Usually, this is a bit lower level than you'd want to be operating...

See server/enip/poll_example_many_with_write.py for an example of how to repetitively poll values from a device, and occasionally write new values without interrupting the polling. Of course, you can just perform the writes without the polling...

Hope that helps!

from cpppo.

 avatar commented on July 20, 2024

@pjkundert Do you have any examples of just writing to a device? I can read from a device quite easily using a symbolic tag, but I am having trouble trying to write to a CompactLogix PLC using get_attribute proxy.

from cpppo.

pjkundert avatar pjkundert commented on July 20, 2024

Take a look at the documentation at https://github.com/pjkundert/cpppo, and search for "proxy.write". You can use the proxy API to write, by supplying a "Tag = ", instead of just "Tag".

from cpppo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.