You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using the python client sdk and i found a missing item. So maybe i'm not using correctly the SDK but when my gateway device TBGatewayMqttClient suscribe for attribute with gw_subscribe_to_attribute, the device name is not shared to the callback.
This is a problem for me because when i modify an attribute on TB dashboard i get the new attribute name : value but i do not get the device corresponding.
In tb_gateway_mqtt.py i had to make a modification in method called "_on_decoded_message" to make this happened :
`elif message.topic == GATEWAY_ATTRIBUTES_TOPIC:
with self._lock:
# callbacks for everything
if self.__sub_dict.get("*|*"):
for callback in self.__sub_dict["*|*"]:
self.__sub_dict["*|*"][callback](self, content["data"])
# callbacks for device. in this case callback executes for all attributes in message
target = content["device"] + "|*"
if self.__sub_dict.get(target):
for callback in self.__sub_dict[target]:
self.__sub_dict[target][callback](self, content["data"])
# callback for atr. in this case callback executes for all attributes in message
targets = [content["device"] + "|" + callback for callback in content["data"]]
for target in targets:
if self.__sub_dict.get(target):
for sub_id in self.__sub_dict[target]:
self.__sub_dict[target][sub_id](self, content["data"])`
to
`elif message.topic == GATEWAY_ATTRIBUTES_TOPIC:
with self._lock:
# callbacks for everything
if self.__sub_dict.get("*|*"):
for callback in self.__sub_dict["*|*"]:
self.__sub_dict["*|*"][callback](self, content["device"], content["data"])
# callbacks for device. in this case callback executes for all attributes in message
target = content["device"] + "|*"
if self.__sub_dict.get(target):
for callback in self.__sub_dict[target]:
self.__sub_dict[target][callback](self, content["device"], content["data"])
# callback for atr. in this case callback executes for all attributes in message
targets = [content["device"] + "|" + callback for callback in content["data"]]
for target in targets:
if self.__sub_dict.get(target):
for sub_id in self.__sub_dict[target]:
self.__sub_dict[target][sub_id](self, content["device"], content["data"])`
adding content["device"] allows me to get the device name in the callback and execute correspond process for this particular device. Is there another way to get the same result or do you think this modification has to be implemented ?
The text was updated successfully, but these errors were encountered:
Hi there !
I'm currently using the python client sdk and i found a missing item. So maybe i'm not using correctly the SDK but when my gateway device TBGatewayMqttClient suscribe for attribute with gw_subscribe_to_attribute, the device name is not shared to the callback.
This is a problem for me because when i modify an attribute on TB dashboard i get the new attribute name : value but i do not get the device corresponding.
In tb_gateway_mqtt.py i had to make a modification in method called "_on_decoded_message" to make this happened :
`elif message.topic == GATEWAY_ATTRIBUTES_TOPIC:
to
`elif message.topic == GATEWAY_ATTRIBUTES_TOPIC:
adding content["device"] allows me to get the device name in the callback and execute correspond process for this particular device. Is there another way to get the same result or do you think this modification has to be implemented ?
The text was updated successfully, but these errors were encountered: