thingsboard / thingsboard-gateway

Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.72k stars 829 forks source link

[BUG] about opcua to write tag is not work #424

Closed lyly0906 closed 2 years ago

lyly0906 commented 3 years ago

Describe the issue when i send rpc to opcua for modify value in Tag1, the gateway will show this error.

opcua server is kepserverEX6
image

ps: Updata is ok image

Configuration (Attach your configuration file) It's opcua configuration: { "name": "OPC-UA", "server": { "disableSubscriptions": false, "identity": { "type": "anonymous" }, "mapping": [ { "attributes": [ { "key": "Tag1", "path": "${ns=2;s=Channel1.Device1.Tag1}" }, { "key": "Tag2", "path": "${ns=2;s=Channel1.Device1.Tag2}" } ], "deviceNamePattern": "Device${ns=2;s=Channel1.Device1._System._DeviceId}", "deviceNodePattern": "${ns=2;s=Channel1.Device1}", "rpc_methods": [ { "arguments": [2], "method": "Tag1" }, { "arguments": [ 2, 4 ], "method": "Tag2" } ], "timeseries": [ { "key": "Tag1", "path": ".Tag1" }, { "key": "Tag2", "path": ".Tag2" } ] } ], "name": "Thingsboard OPC-UA client", "scanPeriodInMillis": 5000, "security": "None", "showMap": true, "subCheckPeriodInMillis": 1000, "timeoutInMillis": 5000, "url": "192.168.254.241:49320" } }

In thingsboard 's widget, I use Basic GPIO control

image

Connector name (If you need help with some connector/converter): [e.g. OPCUA Connector]

Error traceback (If it was raised):

 File "/usr/local/lib/python3.6/site-packages/thingsboard_gateway-2.5.2-py3.6.egg/thingsboard_gateway/connectors/opcua/opcua_connector.py", line 229, in server_side_rpc_handler
    result = method["node"].call_method(method[rpc_method], arguments)
  File "/root/.local/lib/python3.6/site-packages/opcua/common/node.py", line 685, in call_method
    return opcua.common.methods.call_method(self, methodid, *args)
  File "/root/.local/lib/python3.6/site-packages/opcua/common/methods.py", line 17, in call_method
    result = call_method_full(parent, methodid, *args)
  File "/root/.local/lib/python3.6/site-packages/opcua/common/methods.py", line 40, in call_method_full
    result = _call_method(parent.server, parent.nodeid, methodid, to_variant(*args))
  File "/root/.local/lib/python3.6/site-packages/opcua/common/methods.py", line 51, in _call_method
    results = server.call(methodstocall)
  File "/root/.local/lib/python3.6/site-packages/opcua/client/ua_client.py", line 602, in call
    data = self._uasocket.send_request(request)
  File "/root/.local/lib/python3.6/site-packages/opcua/client/ua_client.py", line 84, in send_request
    self.check_answer(data, " in response to " + request.__class__.__name__)
  File "/root/.local/lib/python3.6/site-packages/opcua/client/ua_client.py", line 93, in check_answer
    hdr.ServiceResult.check()
  File "/root/.local/lib/python3.6/site-packages/opcua/ua/uatypes.py", line 218, in check
    raise UaStatusCodeError(self.value)

Versions (please complete the following information):

samson0v commented 2 years ago

Hi @lyly0906, please, update your Gateway to the newest version via the master branch and let us know if it helps. Additionally, can you provide what exactly OPC error you take according to this table.

Thanks for your interest in ThingsBoard IoT Gateway.