-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Hello,
I am using the TBDeviceMqttClient class from the "tb_device_mqtt.py".
I am getting this error when launching a firmware update:
File "/home/ubuntu/.local/lib/python3.8/site-packages/tb_device_mqtt.py", line 324, in _on_decoded_message callback = self._attr_request_dict.pop(req_id) KeyError: 1
My question concerns the messages received by the client:
- The client receives all the update details (fw_title, fw_version, fw_tag, fw_size, fw_checksum_algorithm, fw_checksum) on the
"v1/devices/me/attributes"topic - Then if the versions are different the client sends a request and it receives the update on
"v2/fw/request/${requestId}/chunk/${chunk}"topic - The client receives also a message on the
"v1/devices/me/attributes/response/+"topic which includes all the changed shared attributes related to the update
When the client receives a message on the "v1/devices/me/attributes/response/+" topic, it has to get the callback function: callback = self._attr_request_dict.pop(req_id)
However, the self._attr_request_dict is updated (and thus the callback is added to the dict) when the user calls the request_attributes function which calls the _add_attr_request_callback.
In the case of a firmware update, no callback function was added or defined to be called when a message is received on the "v1/devices/me/attributes/response/+" topic, and as a consequence, the error is raised.
Is there any problem in the client script or am I missing something?