Potential [BUG] MQTT connector not honoring client attribute requests , only shared attribute requests
joinke opened this issue · comments
**Describe the issue **
The MQTT connector configuration "attributeRequests" section allows us to get attributes from devices in TB.
From the doc :
"In order to request client-side or shared device attributes to ThingsBoard server node, Gateway allows sending attribute requests."
However client attribute requests are not returned because the connector only calls shared attributes.
The use case is that we're trying to get the MACAddress , a client attribute usually, because we're using espnow protocol to directly send data to esp-devices. Substituting device name with mac address would need an additional table to be maintained
- A quick workaround is just to add the self.__gateway.tb_client.client.gw_request_client_attributes call in the mqtt_connector.py
This will result in 2 calls made , one of them will not return data and not produce an MQTT message. - A proper improvement would probably be similar to what is implemented in SOCKET connector
if len(device['attributeRequests']):
self.__attribute_type = {
'client': self.__gateway.tb_client.client.gw_request_client_attributes,
'shared': self.__gateway.tb_client.client.gw_request_shared_attributes
}
Connector name (If bug in the some connector):
MQTT
Error traceback (If available):
Program :mqtt_connector.py
Method : _process_on_message
Line :692
self.__gateway.tb_client.client.**gw_request_shared_attributes**(
Versions (please complete the following information):
- OS: N/A
- Thingsboard IoT Gateway version : 3.6.3
- Python version 3.10