Skip to content
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

Merged
merged 5 commits into from
May 27, 2023
Merged

Conversation

petebachant
Copy link
Contributor

read_values is a nice and fast way to get a bunch of values in one request, but I wanted access to the SourceTimestamp in addition to the Value, 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.

@AndreasHeine
Copy link
Member

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!

@petebachant
Copy link
Contributor Author

petebachant commented May 19, 2023

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 Client and sync.Client classes? I didn't see that as an instance method.

@petebachant petebachant changed the title Add 'depth' parameter to read_values Add read_attributes method to Client May 19, 2023
@AndreasHeine
Copy link
Member

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 Client and sync.Client classes? I didn't see that as an instance method.

i dont use the sync stuff that often, i need to look deeper into it!

@petebachant
Copy link
Contributor Author

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.

@AndreasHeine
Copy link
Member

AndreasHeine commented May 19, 2023

yes you are right its missing in sync... but it should be an easy addon similar to read_values 😉

@petebachant
Copy link
Contributor Author

petebachant commented May 19, 2023

That is reflected in the current state of this PR. I had to add it to both async and sync.

@@ -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):
Copy link
Member

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?

Copy link
Contributor Author

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):
Copy link
Member

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?

Copy link
Member

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..

@oroulet oroulet merged commit 244f08e into FreeOpcUa:master May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants