Skip to content

Commit

Permalink
Extended error reporting on connect
Browse files Browse the repository at this point in the history
  • Loading branch information
Pacifica15 committed Jan 6, 2024
1 parent cdfeca5 commit 8584332
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions roombapy/remote_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ def connect(self):
self._open_mqtt_connection()
return True
except Exception as e:
_last_error = "Can't connect to {}, error: {}".format(self.address, e)
self.log.error(
"Can't connect to %s, error: %s", self.address, e
)
attempt += 1

self.log.error("Unable to connect to %s", self.address)
if self.on_connect is not None:
self.on_connect(_last_error)
return False

def disconnect(self):
Expand Down
1 change: 1 addition & 0 deletions roombapy/roomba.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def connect(self):
self.time = time.time() # save connection time

def _connect(self):
self.client_error=None
is_connected = self.remote_client.connect()
if not is_connected:
raise RoombaConnectionError(
Expand Down

0 comments on commit 8584332

Please sign in to comment.