thingsboard-python-client-sdk icon indicating copy to clipboard operation
thingsboard-python-client-sdk copied to clipboard

TBGatewayMqttClient device attribute subscription is unreliable

Open sacot41 opened this issue 1 year ago • 1 comments

Hi,

I use a InHand IG502 device has a gateway for other sensors. I use TBGatewayMqttClient class to communicate with Thingsboard. Sensor send telemetry to Thingsboard at different rate, varying between 1 second to 1 hour.

Attributes subscribe made with subscribe_to_all_attributes function for the InHand IG502 attributes work perfectly. Attributes subscribe made with gw_subscribe_to_all_device_attributes function for sensor devices is unreliable. Sometime is work perfectly, sometime, it never receives update from Thingsboard when attributes change is made. I was not able to identify the cause of the issue. When the subscription is broken, it recovers autonomously after some minute.

I add logging to _on_message function in TBGatewayMqttClient. When the problem appears, attribute subscribed by subscribe_to_all_attributes fire the function, but attribute subscribed by gw_subscribe_to_all_device_attributes never fire.

I have difficulty to understand how TBGatewayMqttClient subscribe to device attribute, so I have difficulty to find the root of the problem or a workaround. How can I make device attribute subscription more reliable ?

sacot41 avatar Sep 17 '24 14:09 sacot41

I create a test project that reproduce the problem : https://github.com/sacot41/Test_subcrib_unreliable

sacot41 avatar Sep 26 '24 14:09 sacot41