Replies: 3 comments 6 replies
-
the string name is the path in KEPServerEX6! but not on all OPC UA Servers its a implementation detail of kepware. |
Beta Was this translation helpful? Give feedback.
-
Get parent , is the only reliable way to get parent of a node. Kepware server i broken if it does not have that information. |
Beta Was this translation helpful? Give feedback.
-
I tried to write a variant of the method that can determine the ancestor by a string identifier. I'm not sure if I wrote it correctly, and for sure this method may have drawbacks, but so far this is what came to mind. As a result, now it turns out to take parent nodes if the server is, for example, KepServerEx6. async def get_parent(self):
"""
returns parent of the node.
A Node may have several parents, the first found is returned.
This method uses reverse references, a node might be missing such a link,
thus we will not find its parent.
"""
refs = await self.get_references(refs=ua.ObjectIds.HierarchicalReferences, direction=ua.BrowseDirection.Inverse)
node = None
if len(refs) > 0:
node = Node(self.server, refs[0].NodeId)
else:
if self.nodeid.NodeIdType == NodeIdType.String:
node_id = NodeId(NamespaceIndex=self.nodeid.NamespaceIndex, Identifier='.'.join(self.nodeid.Identifier.split('.')[:-1]))
if not len(node_id.Identifier) > 0:
# I'm not sure if I did the right thing, but I haven't yet found a way to determine the exact belonging of a node to any base
# node of the specification, since there is no reference to the parent, so by default we assume that such nodes have an
# ancestor in the form of ObjectsFolder (i = 85)
node_id = ua.ObjectIds.ObjectsFolder
node = Node(self.server, node_id)
return node |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Using the library, I'm trying to get nodes from KEPServerEx6. Noticed that from these nodes the parent node is not returned when trying to call get_parent(). It turns out that the KEP does not have a reverse link.

How then can I get parent nodes?
I noticed the following entries in nodeID:
ns=2;s=OPC Chanel.Device1.vPLC1.myNewStaticObject1.myNewStaticObject1_1.static_param1
Is the node identifier a full path to it and can parent links be derived from it? Has anyone tried it?
Beta Was this translation helpful? Give feedback.
All reactions