Opcua-asyncio python script cannot access tag values using their string paths

I have a python script that uses opcua-asyncio. Client authentication is successful. The client code can be found here:

I can successfully get data for these methods that don’t require arguments.

  1. get_root_node
  2. get_objects_node
  3. get_server_node

Which return these respective values:

  1. i=84
  2. i=85
  3. i=2253

This validates that the script works.

The difficulty I’m facing is in correctly identifying tags to get their reported values.

I have used the Ignition designer to copy the path to any tag value of choice for example "[default]The/Full/Tag Path/Including Spaces/Output.value"

When I use the get_node method where the nodeID is "ns=1;s=[default]The/Full/Tag Path/Including Spaces/Output.value"

I get this error "ERROR:asyncua:The node id refers to a node that does not exist in the server address space.(BadNodeIdUnknown)"

The server is configured to "Expose Tag Providers".

The same error occurs whether I use a "ns" name space value of 1, 2, 3 etc.

  1. What is the correct format for the tag path I should be using?
  2. Is the NodeID string formatted correctly?

To verify that the server is configured correctly, use the OPC quick client in the gateway config webpage, are you able to browse the desired tags there?
If so, you might have good luck copying the path (nsu=…) as displayed after attempting a [r]ead on a specific tag.

Exposed Tags are always in namespace index 2.

Have you restarted since enabling Exposed Tags? Have you tried a third party client like UaExpert to see what the NodeIds look like?

This worked for me:

foo = await client.get_node("ns=2;s=[default]/Foo").get_value()
bar = await client.get_node("ns=2;s=[default]/Folder/Bar").get_value()
print(f"foo value: {foo}")
print(f"bar value: {bar}")
1 Like