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

Disconnected client, result code 1 [Thingsboard gateway-Python module] #575

Closed santobedi closed 2 years ago

santobedi commented 3 years ago

Describe the issue screenshot

Why is the client getting disconnected frequently? I can see a device being created in my Web UI (as per deviceNameJsonExpression and deviceTypeJsonExpression in my mqtt.json file) and the telemetry is being updated on this device. However, when I exit out of MobaXterm (the tool I'm using to access my microcomputer where thingboard gateway is installed), the telemetry is no longer updated.

UPDATE: If I run sudo systemctl start thingsboard-gateway , I've no problem at all. What does really happen when I run only thingsboard-gateway command as mentioned here?

Connector name (If you need help with some connector/converter): MQTT Connector

samson0v commented 3 years ago

Hi @santobedi, when you run only thingsboard-gateway, that's run gateway as a terminal app but not as a background task (as a service), for this reason, when you logged out from your server, the terminal close all "foreground" task. For more understanding example: if you run the VIM/Nano/Emacs in your terminal and logged out, the text editor will close. Thanks for your interest in ThingsBoard IoT Gateway!

santobedi commented 3 years ago

@samson0v Thank you for the reply. My system is working properly now (after starting the gateway). However, I still wonder about the frequent 'Disconnected' debug msg (it happens after rerunning the gateway with python command and the 'thingsboard-gateway' command. Is it a normal behavior?

samson0v commented 3 years ago

@santobedi no, it is very strange behaviour.

imbeacon commented 3 years ago

Hi @santobedi ,

How many configuration do you have in mqtt.json for devices and datapoints? It looks like processing take much time and client disconnects.

santobedi commented 3 years ago

@zbeacon It happens even without using the MQTT connector. For example, I'm implementing other protocols like Modbus and BACnet (separately at different Raspberry Pi), I still can see such frequent disconnects.

samson0v commented 3 years ago

Hi @santobedi, in Gateway version 2.9 was added minPackSendDelayMS argument to the main config file to send a lot of data in the one package. For example:

зображення

Try to use it and let us know if it helps.

Thanks for your interest in ThingsBoard IoT Gateway!

samson0v commented 2 years ago

Hi @santobedi, did it help, can we close the issue?

santobedi commented 2 years ago

Hello @samson0v , I've not used Version 2.9 yet. I hope it will solve the issue. It's fine to close the issue. Thank you.