From 9c92c5c47f8360367c60bb223162d571f2b991af Mon Sep 17 00:00:00 2001 From: openhands Date: Sat, 1 Nov 2025 20:03:20 +0000 Subject: [PATCH] fix: Remove explicit security policy setting from OPC UA client Let the client automatically negotiate security policy with the server instead of trying to set it explicitly --- src/dashboard/protocol_clients.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dashboard/protocol_clients.py b/src/dashboard/protocol_clients.py index 41daf3a..b599e9e 100644 --- a/src/dashboard/protocol_clients.py +++ b/src/dashboard/protocol_clients.py @@ -23,12 +23,15 @@ class OPCUAClient: """Connect to OPC UA server.""" try: from asyncua import Client + from asyncua.crypto.security_policies import SecurityPolicyBasic256Sha256 + self._client = Client(url=self.endpoint) # Explicitly set security policy to match server configuration # The server supports both Basic256Sha256 and None security policies # Use None for development/testing - await self._client.set_security_string("http://opcfoundation.org/UA/SecurityPolicy#None") + # Try connecting without explicit security policy first + # The client should automatically negotiate with the server # Set timeout for connection await asyncio.wait_for(self._client.connect(), timeout=5.0)