thingsboard-gateway: Possible Regex issue with OPC UA Connector - IndexError: list index out of range
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
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 40 (21 by maintainers)
Commits related to this issue
- Fix for OPC-UA connector. Issue #234 — committed to thingsboard/thingsboard-gateway by imbeacon 4 years ago
- #234 NoneType object is not subscriptable fix. — committed to thingsboard/thingsboard-gateway by imbeacon 4 years ago
Hi @kevz93 ,
We ave released new version. I rewrote search, please try and give feedback.
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.
@kevz93
I found the problem with interpretation a method node as a variable node. Please try to use version from master branch with f70800b commit.
I removed this function, when i wrote search. But if you think this feature is useful, I can add it.