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.74k stars 844 forks source link

[HELP] No Data from OPC-UA connector with TB-gateway 2.9 #637

Closed hangusto closed 2 years ago

hangusto commented 2 years ago

Hello everyone,

I tried to connect the tb-gateway to Thingsboard and OPC-UA server (Kepware) by opcua connector.

image image

But it cannot get the data from OPC-UA server to Thingsboard.

image

I followed the the configuration setting and it was work on tb-gateway version 2.6

Here is my opcua.json which is the same on tb-gateway version 2.9:

{
  "server": {
    "name": "OPC-UA Default Server",
    "url": "opc.tcp://host.docker.internal:49320",
    "timeoutInMillis": 5000,
    "scanPeriodInMillis": 5000,
    "disableSubscriptions": false,
    "subCheckPeriodInMillis": 100,
    "showMap": false,
    "security": "Basic256Sha256",
    "identity": {
      "type": "anonymous"
    },
    "mapping": [
      {
        "deviceNodePattern": "${Root\\.Objects\\.Simulator\\.Device1}",
        "deviceNamePattern": "G-sensor",
        "attributes": [
        ],
        "timeseries": [
          {
            "key": "G-sensor-x",
            "path": "${G-sensor-x}"
          },
          {
            "key": "G-sensor-y",
            "path": "${G-sensor-y}"
          },
      {
        "key": "G-sensor-z",
        "path": "${G-sensor-z}"
      }
        ]
      }
    ]
  }
}

Does anyone know what are the differences from the versions of gateway? I want to figure out it. Thx.

Versions:

samson0v commented 2 years ago

Hi @hangusto, alternative you can use the next:

{
     "key": "G-sensor-x",
     "path": "${ns=2;i=5}"
},

I think you can find ns and i arguments in KEPServerEX 6 node info panel.

Thanks for your interest in ThingsBoard IoT Gateway.

samson0v commented 2 years ago

Hi @hangusto, did it help, can we close the issue?

hangusto commented 2 years ago

@samson0v Thx, it is work.