Coder Social home page Coder Social logo

Comments (13)

Destination2Unknown avatar Destination2Unknown commented on August 16, 2024 1

Looks good to me, thanks again!

from pylogix.

dmroeder avatar dmroeder commented on August 16, 2024

I have a fix for this.

from pylogix.

Destination2Unknown avatar Destination2Unknown commented on August 16, 2024

@dmroeder Sweet!

from pylogix.

Destination2Unknown avatar Destination2Unknown commented on August 16, 2024

I think this was the issue:

pylogix/pylogix/eip.py

Lines 435 to 436 in 95d6bc9

if not conn[0]:
return [Response(t, None, conn[1]) for t in tags[1]]

It should be something like:

if not conn[0]:
    return [Response(t[0], None, conn[1]) for t in tags]

from pylogix.

dmroeder avatar dmroeder commented on August 16, 2024

You mind testing the bugfix/multi-write branch when you get time? It works for me, though things weren't quite failing in the same way for me.

from pylogix.

Destination2Unknown avatar Destination2Unknown commented on August 16, 2024

Pretty much sorted, only case where it didn't work was where the tags don't exist and there is no connection to the PLC (i.e. if the IP Address is incorrect):

from pylogix import PLC

with PLC() as comm:
    comm.IPAddress = "192.168.133.199"

    write_data = [("tag1", 100), ("tag2", 6.45), ("tag3", True)]

    # write the values
    ret = comm.Write(write_data)

    # print the status of the writes
    for r in ret:
        print(r.TagName, r.Status)

prints:

tag2 Unknown error timed out
6.45 Unknown error timed out

#224 (comment)

from pylogix.

Destination2Unknown avatar Destination2Unknown commented on August 16, 2024

This fairly niche example isn't quite right either...

write_data = [("myDint", 100), ("myString", "Hello"), ("myDint.1", True)]

# write the values
ret = comm.Write(write_data)

# print the status of the writes
for r in ret:
    print(r.TagName, r.Value, r.Status)

prints:

myDint 100 Success
myString Hello Success
myDint.1 (2, -1) Success

from pylogix.

dmroeder avatar dmroeder commented on August 16, 2024

Yeah, that is weird. The latest should fix it.

from pylogix.

Destination2Unknown avatar Destination2Unknown commented on August 16, 2024

Yeah, that is weird. The latest should fix it.

This case is still incorrect:

from pylogix import PLC

with PLC() as comm:
    comm.IPAddress = "192.168.133.199" #incorrect IP address

    write_data = [("tag1", 100), ("tag2", 6.45), ("tag3", True)]

    # write the values
    ret = comm.Write(write_data)

    # print the status of the writes
    for r in ret:
        print(r.TagName, r.Status)

prints:

tag2 Unknown error timed out
6.45 Unknown error timed out

from pylogix.

dmroeder avatar dmroeder commented on August 16, 2024

I see, somehow, I missed that comment originally

from pylogix.

dmroeder avatar dmroeder commented on August 16, 2024

Okay, that one should be fixed on that branch too.

I considered whether to return the value that was written or the None. I went with value intended to write because that is what would be returned on a successful write. Though I could be convinced otherwise.

from pylogix.

Destination2Unknown avatar Destination2Unknown commented on August 16, 2024

Okay, that one should be fixed on that branch too.

I considered whether to return the value that was written or the None. I went with value intended to write because that is what would be returned on a successful write. Though I could be convinced otherwise.

I strongly favour returning None because it would make it crystal clear that there was an issue.
Otherwise, it could lead to confusion when a write value is returned despite not being sent successfully.

Thank you for your assistance.
This library is exceptional, and the support provided is truly outstanding!

from pylogix.

dmroeder avatar dmroeder commented on August 16, 2024

Sold! I'll return None. I appreciate your feedback and testing.

from pylogix.

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.