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

tb_gateway_service - 573 - list indices must be integers or slices, not dict" for deviceType #820

Closed sferguson-ISI closed 2 years ago

sferguson-ISI commented 2 years ago

Getting an error when "deviceTypeJsonExpression" is a static string such as "genericName" when set in the mqtt connector. This happened after upgrading from 2.6 to 3.0.1. i.e.

...
        "deviceTypeJsonExpression": "genericName",
...

If I change it to the below, the error goes away.

...
        "deviceTypeJsonExpression": "${sensorName}",
...

Connector name (If bug in the some connector): mqtt.json

Error traceback (If available):

""2022-05-05 23:47:02" - ERROR - [tb_gateway_service.py] - tb_gateway_service - 573 - 'deviceType'"
""2022-05-05 23:47:02" - ERROR - [tb_gateway_service.py] - tb_gateway_service - 573 - list indices must be integers or slices, not dict"

Versions (please complete the following information):

samson0v commented 2 years ago

Hi @sferguson-ISI, I tested it in my local setup with version 3.0.1 and there is no bug. Try to make a clear installation of your Gateway or use the newest version from the master branch. Thanks for your interest in ThingsBoard IoT Gateway!