How can I fix "BadNodeIdUnknown" error reading OPC UA sensor data on UP Squared board?

Hello dev i am setting up an industrial IoT gateway using an UP Squared board with Embedded Linux. The gateway should read data from an OPC UA temperature sensor, I have confirmed the OPC UA server IP address and endpoint, checked the node ID and namespace index, made sure the OPC UA client library is correctly installed and configured.
But i am getting the error Error reading temperature: BadNodeIdUnknown

from opcua import Client

client = Client("opc.tcp://192.168.1.10:4840")
client.connect()

try:
    temperature_node = client.get_node("ns=2;i=2")
    temperature = temperature_node.get_value()
    print(f"Temperature: {temperature}")
except Exception as e:
    print(f"Error reading temperature: {e}")
finally:
    client.disconnect()

@Middleware & OS
Was this page helpful?