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

OPC UA Connector connected but no data is received on Dashboard[HELP] #330

Closed sayyam1994 closed 4 years ago

sayyam1994 commented 4 years ago

Describe the issue I am trying to connect Thingsboard to Kepserverex v6.7 but I am not getting any data on Dashboard even after successfully connecting to the opc connector. I think the issue is with incorrect mapping in opcua.json file.

opcua.json file:-

{ "server": { "name": "Thingsboard OPC-UA client", "url": "127.0.0.1:49320", "timeoutInMillis": 5000, "scanPeriodInMillis": 5000, "disableSubscriptions":false, "subCheckPeriodInMillis": 100, "showMap": false, "security": "None", "identity": { "type": "anonymous" }, "mapping": [ { "deviceNodePattern": "Channel1\.Device\d+$", "deviceNamePattern": "Device ${_System._DeviceId}", "attributes": [ { "key": "Tag1", "path": "${ns=2;s=Channel1.Device1.Tag1}" } ], "timeseries": [ { "key": "Tag2", "path": "${ns=2;s=Channel1.Device1.Tag2}" } ] } ] } }

I am using thingsboard-gateway 2.4. Kindly help me in getting the right configuration

Versions:-

imbeacon commented 4 years ago

Hi @sayyam1994

Thank you for your interest in the ThingsBoard IoT gateway. Please set path in the parameters from values like "ns=2;s=Channel1.Device1.Tag1" to "Channel1\.Device1\.Tag1". Node path delimiters are "\." instead of "." or ".".

The configuration example is:


{
  "server": {
    "name": "Thingsboard OPC-UA client",
    "url": "127.0.0.1:49320",
    "timeoutInMillis": 5000,
    "scanPeriodInMillis": 5000,
    "disableSubscriptions": false,
    "subCheckPeriodInMillis": 100,
    "showMap": false,
    "security": "None",
    "identity": {
      "type": "anonymous"
    },
    "mapping": [
      {
        "deviceNodePattern": "Channel1\\.Device\\d+$",
        "deviceNamePattern": "Device ${Root\\._System\\._DeviceId}",
        "attributes": [
          {
            "key": "Tag1",
            "path": "${Channel1\\.Device1\\.Tag1}"
          }
        ],
        "timeseries": [
          {
            "key": "Tag2",
            "path": "${Channel1\\.Device1\\.Tag2}"
          }
        ]
      }
    ]
  }
}
sayyam1994 commented 4 years ago

Thanks for your quick response.

I tried with the above configuration but still I am not getting any data on dashboard.

ocpua.json

{ "server": { "name": "Thingsboard OPC-UA client", "url": "127.0.0.1:49320", "timeoutInMillis": 5000, "scanPeriodInMillis": 5000, "disableSubscriptions": false, "subCheckPeriodInMillis": 100, "showMap": false, "security": "None", "identity": { "type": "anonymous" }, "mapping": [ { "deviceNodePattern": "Channel1\.Device\d+$", "deviceNamePattern": "Device ${Root\._System\._DeviceId}", "attributes": [ { "key": "Tag1", "path": "${Channel1\.Device1\.Tag1}" } ], "timeseries": [ { "key": "Tag2", "path": "${Channel1\.Device1\.Tag2}" } ] } ] } }

Screenshot of my Kepserver Configuration:- Capture

imbeacon commented 4 years ago

Okay, please attach information from connector.log file in the logs folder.

sayyam1994 commented 4 years ago

""2020-06-28 16:40:37" - INFO - [opcua_connector.py] - opcua_connector - 130 - Reconnected to the OPC-UA server - 127.0.0.1:49320" ""2020-06-29 12:49:44" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 12:49:44" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:09:59" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:10:00" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:15:41" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:15:41" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:17:30" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:17:30" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:20:58" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:20:58" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:26:19" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:26:19" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:29:39" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:29:39" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:35:23" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:35:24" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:37:38" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:37:38" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:37:54" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:37:54" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320" ""2020-06-29 13:54:19" - INFO - [opcua_connector.py] - opcua_connector - 96 - Starting OPC-UA Connector" ""2020-06-29 13:54:19" - INFO - [opcua_connector.py] - opcua_connector - 121 - OPC-UA connector OPC-UA Connector connected to server 127.0.0.1:49320"

imbeacon commented 4 years ago

It cannot connect correctly to the OPC-UA server. Please chenge the level of the logging in the file config\logs.conf from INFO to DEBUG, run the gateway again and send file. Also you can archive the logs and email me ibarkov@thingsboard.io

sayyam1994 commented 4 years ago

I have sent the mail

imbeacon commented 4 years ago

I saw them, but I didn't see the map of the server. Did you set up the parameter "showMap" to true in config?

sayyam1994 commented 4 years ago

I have sent the updated logs after enabling "showMap = True"

imbeacon commented 4 years ago

Ok, I saw, please try the following configuration:


{
  "server": {
    "name": "Thingsboard OPC-UA client",
    "url": "127.0.0.1:49320",
    "timeoutInMillis": 5000,
    "scanPeriodInMillis": 5000,
    "disableSubscriptions": false,
    "subCheckPeriodInMillis": 100,
    "showMap": true,
    "security": "None",
    "identity": {
      "type": "anonymous"
    },
    "mapping": [
      {
        "deviceNodePattern": "Channel1\\.Device\\d+$",
        "deviceNamePattern": "Device ${Root\\._System\\._DeviceId}",
        "attributes": [
          {
            "key": "Tag1",
            "path": "${Tag1}"
          }
        ],
        "timeseries": [
          {
            "key": "Tag2",
            "path": "${Tag2}"
          }
        ]
      }
    ]
  }
}
sayyam1994 commented 4 years ago

I also tried connecting the opc ua server in ubuntu but still same issue. I am not getting any data even after successfully connecting with thingsboard gateway.