Skip to content

Commit

Permalink
Fix for failed connection reason
Browse files Browse the repository at this point in the history
  • Loading branch information
imbeacon committed Mar 1, 2024
1 parent 20f3d92 commit 558878f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
with open(path.join(this_directory, 'README.md')) as f:
long_description = f.read()

VERSION = "1.8.2"
VERSION = "1.8.3"

setup(
version=VERSION,
Expand Down
12 changes: 8 additions & 4 deletions tb_device_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import ssl
from threading import Lock, RLock, Thread, Condition

from paho.mqtt.reasoncodes import ReasonCodes
from simplejson import loads, dumps, JSONDecodeError

from sdk_utils import verify_checksum
Expand Down Expand Up @@ -362,10 +363,13 @@ def _on_connect(self, client, userdata, flags, result_code, *extra_params):
self._client.subscribe(RPC_REQUEST_TOPIC + '+', qos=self.quality_of_service)
self._client.subscribe(RPC_RESPONSE_TOPIC + '+', qos=self.quality_of_service)
else:
if result_code in RESULT_CODES:
log.error("connection FAIL with error %s %s", result_code, RESULT_CODES[result_code])
else:
log.error("connection FAIL with unknown error")
if isinstance(result_code, int):
if result_code in RESULT_CODES:
log.error("connection FAIL with error %s %s", result_code, RESULT_CODES[result_code])
else:
log.error("connection FAIL with unknown error")
elif isinstance(result_code, ReasonCodes):
log.error("connection FAIL with error %s %s", result_code, result_code.getName())

def get_firmware_update(self):
self._client.subscribe("v2/fw/response/+")
Expand Down

0 comments on commit 558878f

Please sign in to comment.