Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential [BUG] MQTT connector not honoring client attribute requests , only shared attribute requests #1363

Closed
joinke opened this issue Apr 7, 2024 · 1 comment
Assignees
Labels
bug can be closed If bug fixed or feature is implemented

Comments

@joinke
Copy link

joinke commented Apr 7, 2024

**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
@imbeacon
Copy link
Member

Hi @joinke,

Thank you for your interest in ThingsBoard IoT Gateway.
We have added ability to request client attributes in MQTT connector, to do this you can use "scope" parameter in configuration or in the incoming message. Expected values for "scope" - "client"/"shared".

@imbeacon imbeacon added the can be closed If bug fixed or feature is implemented label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug can be closed If bug fixed or feature is implemented
Projects
None yet
Development

No branches or pull requests

3 participants