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

The value.nodeid method returned by the read function returns Nil #772

Open
mijjjj opened this issue Feb 13, 2025 · 4 comments
Open

The value.nodeid method returned by the read function returns Nil #772

mijjjj opened this issue Feb 13, 2025 · 4 comments

Comments

@mijjjj
Copy link

mijjjj commented Feb 13, 2025

The value.nodeid method returned by the read function returns Nil, which makes it impossible for me to locate the value I get back after sending multiple nodeids.

@magiconair
Copy link
Member

I would need a bit more context to understand the problem. Did you check the StatusCode if that was OK? Does the node you are reading have a NodeID as value data type?

Did you have a look at https://github.com/gopcua/opcua/blob/main/examples/read/read.go ?

@mijjjj
Copy link
Author

mijjjj commented Feb 13, 2025

I just used the corresponding code in the example. The specific code is as follows. req.ReqData contains multiple nodeids. When reading the results, the nodeid obtained through resp.Results[0].Value.NodeID() is nil

Image

@mijjjj
Copy link
Author

mijjjj commented Feb 13, 2025

At present, when I want to determine which nodeid it is, I can only judge it by the array address.

@hbrackel
Copy link

hbrackel commented Feb 13, 2025

@mijjjj Could you please provide your ReadRequest, in particular the NodesToRead array?

If you are requesting attribute values from multiple NodeIds, the ReadResponse provides an array of DataValues (one per requested NodeId and Attribute). None of the DataValues contains information about the NodeId or AttributeId from which it has been read, so you need to associate the returned DataValues with the NodeToRead by position (aka array index). This is how the OPC UA standard wants it to be and is not related to gopcua.

If you mean a variable of DataType = NodeId and being a single dimension array, that works fine and delivered the expected nodeId values (just tested it)

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

No branches or pull requests

3 participants