From 2bebfd578b7a7a325813d9120ee8c770f95a6c10 Mon Sep 17 00:00:00 2001 From: samson0v Date: Thu, 22 Feb 2024 13:01:21 +0200 Subject: [PATCH] Fixed reading GUID nodes for OPC-UA connector --- thingsboard_gateway/connectors/opcua/opcua_connector.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/thingsboard_gateway/connectors/opcua/opcua_connector.py b/thingsboard_gateway/connectors/opcua/opcua_connector.py index 266e706f0..655115ebc 100644 --- a/thingsboard_gateway/connectors/opcua/opcua_connector.py +++ b/thingsboard_gateway/connectors/opcua/opcua_connector.py @@ -14,6 +14,7 @@ import re import time +from uuid import UUID from concurrent.futures import CancelledError, TimeoutError as FuturesTimeoutError from copy import deepcopy from random import choice @@ -624,6 +625,14 @@ def __search_node(self, current_node, fullpath, search_method=False, result=None self._log.warning("NODE NOT FOUND - using configuration %s", fullpath) else: self._log.debug("Found in %s", node) + + # this unnecessary code is added to fix the issue with the to_string method of the NodeId class + # and can be deleted after the fix of the issue in the library + if node.nodeid.NodeIdType == ua.NodeIdType.Guid: + node.nodeid = ua.NodeId(UUID(node.nodeid.Identifier), node.nodeid.NamespaceIndex, + nodeidtype=ua.NodeIdType.Guid) + # -------------------------------------------------------------------------------------------------- + result.append(node) else: fullpath_pattern = regex.compile(fullpath)