Skip to content

Commit 275e4d8

Browse files
committed
Added ability to retrieve all attributes for device
1 parent fec1a57 commit 275e4d8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tb_gateway_mqtt.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ def _on_decoded_message(self, content, message, **kwargs):
132132
req_id = content["id"]
133133
self._devices_connected_through_gateway_messages_rate_limit.increase_rate_limit_counter(1)
134134
# pop callback and use it
135-
if self._attr_request_dict[req_id]:
135+
if self._attr_request_dict.get(req_id):
136136
callback = self._attr_request_dict.pop(req_id)
137137
if isinstance(callback, tuple):
138138
callback[0](content, None, callback[1])
139139
else:
140140
callback(content, None)
141141
else:
142-
log.error("Unable to find callback to process attributes response from TB")
142+
log.error("Unable to find callback to process attributes response from platform.")
143143
elif message.topic == GATEWAY_ATTRIBUTES_TOPIC:
144144
with self._lock:
145145
# callbacks for everything
@@ -178,9 +178,6 @@ def _on_decoded_message(self, content, message, **kwargs):
178178
log.debug("Unexpected message from topic %r, content: %r", message.topic, content)
179179

180180
def __request_attributes(self, device, keys, callback, type_is_client=False):
181-
if not keys:
182-
log.error("There are no keys to request")
183-
return False
184181

185182
attr_request_number = self._add_attr_request_callback(callback)
186183
msg = {"keys": keys,

0 commit comments

Comments
 (0)