DaveTheAl
DaveTheAl

Reputation: 2155

Python OPC-UA access node with path

I am trying to connect to variables in an OPC server. I have written an application which connects by specifying the path from the root in a comma-separated-path like this:

PATH_TO_NODE=["0:Objects","2:Child1","2:NodeName"]

However, I just received details that I have to connect to the application using a "common" path like so:

Root\Objects\Child1//NodeName

or also reading from an array (I need to read the entire array)

Root\Objects\Child1//NodeArray/array[1]

How can I achieve this? I have not found any examples that show how this can be done but this should be just a formatting thing I assume.

Upvotes: 1

Views: 1184

Answers (1)

Kevin Herron
Kevin Herron

Reputation: 6985

The "common" path format doesn't encode enough information to successfully call the TranslateBrowsePathsToNodeIds service and turn the path into a NodeId you can use to access Nodes.

At best you can assume everything in your "common" path is a hierarchical reference, which seems to be the same thing your comma-separated path is doing, but without knowing what namespace index each component is in you don't have enough information.

(each component is a QualifiedName identifying the BrowseName attribute of the next Node in the path)

Upvotes: 1

Related Questions