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

tb_device_mqtt on_connect connection FAIL with error Bad user name or password Bad user name or password #1328

Closed struggle3 closed 4 months ago

struggle3 commented 8 months ago

Describe the bug Cannot load GRPC connector! 2024-03-06 13:42:32 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - init - 218 - Gateway starting... 2024-03-06 13:42:32 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - init - 223 - ThingsBoard IoT gateway version: 0.0 2024-03-06 13:42:32 - |INFO| - [tb_gateway_service.py] - tb_gateway_service - init - 309 - Gateway started. 2024-03-06 13:42:32 - |INFO| - [tb_loader.py] - tb_loader - import_module - 68 - Import ModbusConnector from E:\ThingsBoard\src\thingsboard-gateway\thingsboard_gateway\connectors\modbus. 2024-03-06 13:42:34 - |ERROR| - [tb_device_mqtt.py] - tb_device_mqtt - _on_connect - 372 - connection FAIL with error Bad user name or password Bad user name or password 2024-03-06 13:42:34 - |INFO| - [tb_gateway_mqtt.py] - tb_gateway_mqtt - gw_subscribe_to_attribute - 181 - Subscribed to | with id 1 for device * 2024-03-06 13:42:38 - |INFO| - [tb_updater.py] - tb_updater - check_for_new_version - 84 - 3.4.5 2024-03-06 13:42:38 - |INFO| - [tb_updater.py] - tb_updater - check_for_new_version - 86 -

[===UPDATE===]

New version 3.4.5 is available!

[===UPDATE===]

Versions (please complete the following information):

github-actions[bot] commented 8 months ago

Hi @struggle3.
Thank you for your interest in ThingsBoard IoT Gateway.
Your issue was registered, please wait for response from engineer.

IOTGW-152

Allisam-c commented 6 months ago

thingsboard_gateway\gateway\tb_gateway_service.py

change main config if Gateway running with docker env variables

self.__modify_main_config() <---Annotate this line

"Environment variables have more priority than configuration parameters. If you don't pass the variable, the gateway will not use it and it will use values from the configuration file."---issues#1232 The meaning is that in the development environment, the system's environment variables are read here, not from the configuration file.

struggle3 commented 6 months ago

thingsboard_gateway\gateway\tb_gateway_service.py

change main config if Gateway running with docker env variables

self.__modify_main_config() <---Annotate this line

"Environment variables have more priority than configuration parameters. If you don't pass the variable, the gateway will not use it and it will use values from the configuration file."---issues#1232 The meaning is that in the development environment, the system's environment variables are read here, not from the configuration file.

After that, I commented the code. When running cmd, I still cannot connect to the mqtt broker normally.

imbeacon commented 5 months ago

Hi @struggle3,

This issue is fixed in the master branch, you can use it or wait for the release, it is expecting to be at the end of June.