question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possible Regex issue with OPC UA Connector - IndexError: list index out of range

See original GitHub issue

Hello! Below are the versions I’m using: Thingsboard @ 2.4.1 Gateway @ 2.0.0.2 KepEx Server 6.X Demo data

I am not able to scan for devices using the opc-ua.json config file. Im able to get connected and even see some of the data being sent from KEPEx using a packet sniffer(though they aren’t very readable) The logs are as below: Thingsboard :

2020-01-07 13:28:20.520  INFO 30115 --- [ntLoopGroup-4-3] o.t.s.t.mqtt.MqttTransportHandler        : [d7ce6301-84b2-40a9-b93a-39d2ee5c63c5] Processing connect msg for client: !
2020-01-07 13:28:20.520  INFO 30115 --- [ntLoopGroup-4-3] o.t.s.t.mqtt.MqttTransportHandler        : [d7ce6301-84b2-40a9-b93a-39d2ee5c63c5] Processing connect msg for client with user name: N530rKRR83dXx0gmZoiJ!
2020-01-07 13:28:20.523  INFO 30115 --- [ool-8-worker-21] o.t.s.t.mqtt.MqttTransportHandler        : [d7ce6301-84b2-40a9-b93a-39d2ee5c63c5] Client connected!
2020-01-07 13:28:20.548  WARN 30115 --- [ntLoopGroup-4-3] o.t.s.t.mqtt.MqttTransportHandler        : [d7ce6301-84b2-40a9-b93a-39d2ee5c63c5] Failed to subscribe to [v1/gateway/attributes/response/+][AT_MOST_ONCE]
2020-01-07 13:28:20.548  WARN 30115 --- [ntLoopGroup-4-3] o.t.s.t.mqtt.MqttTransportHandler        : [d7ce6301-84b2-40a9-b93a-39d2ee5c63c5] Failed to subscribe to [v1/gateway/rpc/+][AT_MOST_ONCE]

Gateway:

cat /var/log/thingsboard-gateway/connector.log 
''2020-01-07 13:28:22' - INFO - opcua_connector - 86 - Starting OPC-UA Connector'
''2020-01-07 13:28:22' - INFO - opcua_connector - 102 - OPC-UA connector OPC-UA Default Server Connector connected to server 192.168.0.112:49321/'
''2020-01-07 13:28:23' - ERROR - opcua_connector - 203 - list index out of range'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/thingsboard_gateway-2.0-py3.6.egg/thingsboard_gateway/connectors/opcua/opcua_connector.py", line 174, in __search_name
    if re.search(int_node.split('\\.')[recursion_level-2], ch.get_display_name().Text):
IndexError: list index out of range
''2020-01-07 13:28:24' - ERROR - opcua_connector - 259 - list index out of range'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/thingsboard_gateway-2.0-py3.6.egg/thingsboard_gateway/connectors/opcua/opcua_connector.py", line 214, in __search_tags
    if re.search(int_node.split('\\.')[recursion_level-2], ch.get_display_name().Text):
IndexError: list index out of range
''2020-01-07 13:28:24' - DEBUG - opcua_connector - 108 - Subscriptions: {}'
''2020-01-07 13:28:24' - DEBUG - opcua_connector - 109 - Available methods: {}'
cat /var/log/thingsboard-gateway/service.log
''2020-01-07 13:28:20' - DEBUG - tb_utility - 61 - Load connector for opcua class name - OpcUaConnector from /usr/local/lib/python3.6/dist-packages/thingsboard_gateway-2.0-py3.6.egg/thingsboard_gateway/connectors/opcua'
''2020-01-07 13:28:20' - DEBUG - tb_utility - 66 - ModuleSpec(name='OpcUaConnector', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f16d1c171d0>, origin='/usr/local/lib/python3.6/dist-packages/thingsboard_gateway-2.0-py3.6.egg/thingsboard_gateway/connectors/opcua/opcua_converter.py')'
''2020-01-07 13:28:20' - DEBUG - tb_utility - 72 - <module 'OpcUaConnector' from '/usr/local/lib/python3.6/dist-packages/thingsboard_gateway-2.0-py3.6.egg/thingsboard_gateway/connectors/opcua/opcua_converter.py'>'
''2020-01-07 13:28:20' - DEBUG - tb_utility - 66 - ModuleSpec(name='OpcUaConnector', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f16d1bc91d0>, origin='/usr/local/lib/python3.6/dist-packages/thingsboard_gateway-2.0-py3.6.egg/thingsboard_gateway/connectors/opcua/opcua_connector.py')'
''2020-01-07 13:28:20' - DEBUG - tb_utility - 72 - <module 'OpcUaConnector' from '/usr/local/lib/python3.6/dist-packages/thingsboard_gateway-2.0-py3.6.egg/thingsboard_gateway/connectors/opcua/opcua_connector.py'>'
''2020-01-07 13:28:22' - DEBUG - tb_gateway_service - 380 - Loaded devices:

opcua.json:

{
  "server": {
    "name": "OPC-UA Default Server",
    "url": "192.168.0.112:49321/",
    "scanPeriodInMillis": 10000,
    "timeoutInMillis": 5000,
    "security": "Basic128Rsa15",
    "identity": {
      "type": "anonymous"
    },
    "mapping": [
      {
        "deviceNodePattern": "Channel1\\.Device\\d+$",
        "deviceNamePattern": "Device ${_System._DeviceId}",
        "attributes": [
          {
            "key": "Tag2",
            "path": "${Tag2}"
          }
        ],
        "timeseries": [
          {
            "key": "Tag1",
            "path": "${Tag1}"
          },
          {
            "key": "Tag2",
            "path": "${Tag2}"
          }
        ]
      }
    ]
  }
}

tb_gateway.yml

thingsboard:
  host: 127.0.0.1
  port: 1883
  security:
    accessToken: N530rKRR83dXx0gmZoiJ
storage:
  type: memory
  read_records_count: 100
  max_records_count: 100000
#  type: file
#  data_folder_path: ./data/
#  max_file_count: 10
#  max_read_records_count: 10
#  max_records_per_file: 10000
connectors:
-
  name: OPC-UA Connector
  type: opcua
  configuration: opcua.json

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:40 (21 by maintainers)

github_iconTop GitHub Comments

2reactions
imbeaconcommented, Feb 6, 2020

Hi @kevz93 ,

We ave released new version. I rewrote search, please try and give feedback.

2reactions
imbeaconcommented, Jan 7, 2020

Hi, @kevz93

Thank you for your feedback. We know about this problem and work to solve it. Also please try use some variable in device object on the OPC-UA server as a name.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IndexError: list index out of range even though requested ...
Your code contains a for loop iterating through all the lines in the file. The first line starts with "From " and thus...
Read more >
Indexerror: List Index Out Of Range/ Attributeerror - ADocLib
When I punch in the address of the OPCUA server and select Discover Available Endpoint I get this message: 'No endpoints found.
Read more >
Release Notes - Cogent DataHub
[DATAHUB-1599] – MQTT Broker thread crashes with an out of range index error [DATAHUB-1600] – OPC UA server does not handle point values...
Read more >
[Example code]-Python: List out of range - appsloveworld.com
Coding example for the question Python: List out of range. ... sOutput = sOutput.replace(encrypts[x], encrypts[x+1]) IndexError: list index out of range.
Read more >
Why does this script give "IndexError: list index out of range"?
The error says that you are reaching for an index that is outside the list's size. Add a print, what does it say?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found