-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add read_attributes
method to Client
#1311
Conversation
the timestamp and statuscode will be present if you just use read attribute method which return is a datavalue. read_values is a highlevel-abstraction of read_attributes! |
Are those accessible from the |
read_attributes
method to Client
i dont use the sync stuff that often, i need to look deeper into it! |
FWIW, it didn't look like the async Client had the method either. |
yes you are right its missing in sync... but it should be an easy addon similar to read_values 😉 |
That is reflected in the current state of this PR. I had to add it to both async and sync. |
asyncua/client/client.py
Outdated
@@ -865,13 +865,21 @@ async def unregister_nodes(self, nodes): | |||
node.nodeid = node.basenodeid | |||
node.basenodeid = None | |||
|
|||
async def read_attributes(self, nodes, attr=ua.AttributeIds.Value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. But could you add types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type hints added!
@@ -865,13 +865,19 @@ async def unregister_nodes(self, nodes): | |||
node.nodeid = node.basenodeid | |||
node.basenodeid = None | |||
|
|||
async def read_attributes(self, nodes: List[Node], attr: ua.AttributeIds = ua.AttributeIds.Value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment because I wondered what is the return type of that method. Now I am still wondering ;-) since you did not add the type of the reutrn value List[ua.DataValue] maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging now anyway, we are missing types at many places..
read_values
is a nice and fast way to get a bunch of values in one request, but I wanted access to theSourceTimestamp
in addition to theValue
, which wasn't possible with this method, so I added it. If there's another way to read the values and timestamps from hundreds of nodes in one request, this isn't necessary.