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.68k stars 817 forks source link

[BUG] Error log -- Timeout while waiting for a publish to ThingsBoard! #1353

Closed volpima closed 2 months ago

volpima commented 4 months ago

Hello! I'm experiencing an issue with communication between my Raspberry Pi 3B+, which is running the Thingsboard IoT Gateway service version 3.4.5 over Ubuntu Server 22.04 LTS, and the Thingsboard platform running 3.6.2 version. I'm receiving a series of logs on the Raspberry Pi (Iot Gateway), such as "Mar 25 09:08:21 ubuntu python3[2968]: 2024-03-25 09:08:21 - |ERROR| - [tb_device_mqtt.py] - tb_device_mqtt - _publish_data - 687 - Timeout while waiting for a publish to ThingsBoard!" as seen in the screenshot. What could be the cause? The strange thing is that on the cloud platform, I see IoT Gateway as active, so the publish data is probably failing on a topic for communicating some parameters of the smart device. Do you have any suggestions?

image

github-actions[bot] commented 4 months ago

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

IOTGW-190

imbeacon commented 4 months ago

Hi @volpima,

This issue relates to some modification of data sending, please try to use the latest version.

volpima commented 4 months ago

Hi @imbeacon thanks for your support. Do you mean the 3.4.6 for IoT gateway?

Marco

imbeacon commented 4 months ago

Yes, unfortunately it sill be can unstable, we are working now with rate limits per each device created through the gateway, but it is more stable than 3.4.5

volpima commented 4 months ago

Hi @imbeacon any news regarding this issue? Unfortunately, this solution is really unstable; the problem reoccurs every few hours, and the MQTT communication between the IoT Gateway and Thingsboard Community Edition is interrupted, preventing the transmission of data from the Modbus source. Do you have any suggestion?

I noticed this error before the disconnection. Is there a way to automatically restart the service if an error occurs?

Apr 15 17:46:06 ubuntu python3[947]: Exception in thread Sending thread: Apr 15 17:46:06 ubuntu python3[947]: Traceback (most recent call last): Apr 15 17:46:06 ubuntu python3[947]: File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner Apr 15 17:46:06 ubuntu python3[947]: self.run() Apr 15 17:46:06 ubuntu python3[947]: File "/usr/lib/python3.10/threading.py", line 953, in run Apr 15 17:46:06 ubuntu python3[947]: self._target(*self._args, **self._kwargs) Apr 15 17:46:06 ubuntu python3[947]: File "/var/lib/thingsboard_gateway/.local/lib/python3.10/site-packages/tb_device_mqtt.py", line 624, in __sending_thread_main Apr 15 17:46:06 ubuntu python3[947]: self._on_connect(self._client, None, None, 0) Apr 15 17:46:06 ubuntu python3[947]: File "/var/lib/thingsboard_gateway/.local/lib/python3.10/site-packages/tb_gateway_mqtt.py", line 54, in _on_connect Apr 15 17:46:06 ubuntu python3[947]: gateway_attributes_topic_sub_id = int(self._client.subscribe(GATEWAY_ATTRIBUTES_TOPIC, qos=1)[1]) Apr 15 17:46:06 ubuntu python3[947]: TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

samson0v commented 2 months ago

Hi @volpima, Try to use the version from the master branch and let us know the results.

volpima commented 2 months ago

Hi @samson0v it seems to be stable! Thankyou! I'll inform you in case of other problems..thankyou!

ravirajpspl2023 commented 3 weeks ago

hii i am new user in thinsboard gateway when internet is not available then , the connector is store locally . the connector is working as per time of keepalive after that connector aslo close its not working getting this error 2024-07-26T06:42:07.057094717Z 2024-07-26 06:42:07 - |WARNING| - [tb_device_mqtt.py] - tb_device_mqtt - _on_disconnect - 343 - MQTT client was disconnected with reason code 16 (The keepalive time has been exceeded.) 2024-07-26T06:42:07.058525878Z 2024-07-26 06:42:07 - |WARNING| - [tb_device_mqtt.py] - tb_device_mqtt - _on_disconnect - 343 - MQTT client was disconnected with reason code 16 (The keepalive time has been exceeded.) 2024-07-26T06:42:12.056256862Z 2024-07-26 06:42:12 - |WARNING| - [tb_device_mqtt.py] - tb_device_mqtt - _publish_data - 745 - Waiting for connection to be established before sending data to ThingsBoard! 2024-07-26T06:42:22.063701335Z 2024-07-26 06:42:22 - |WARNING| - [tb_device_mqtt.py] - tb_device_mqtt - _publish_data - 745 - Waiting for connection to be established before sending data to ThingsBoard! 2024-07-26T06:42:32.069493370Z 2024-07-26 06:42:32 - |WARNING| - [tb_device_mqtt.py] - tb_device_mqtt - _publish_data - 745 - Waiting for connection to be established before sending data to ThingsBoard!

i what to store data locally when internet is not available how to do this