Skip to content

Commit

Permalink
Merge branch 'main' into PLE1205
Browse files Browse the repository at this point in the history
Signed-off-by: Joost Lekkerkerker <[email protected]>
  • Loading branch information
joostlek authored Feb 21, 2024
2 parents 70a9f3b + 9687fe1 commit 4c051ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ ignore = [
"EM102",
"FBT002",
"FBT003",
"G002",
"G004",
"TRY002",
"TRY003",
"TRY300",
Expand All @@ -75,10 +73,8 @@ ignore = [
"D101", # documentation info, should be removed after fixes
"D102", # documentation info, should be removed after fixes
"D103", # documentation info, should be removed after fixes
"PERF102",
"PLR2004", # Just annoying, not really useful
"PLR0912",
"PLR1714",
"PLW2901",
"RET507",
"SIM102",
Expand Down
10 changes: 6 additions & 4 deletions roombapy/remote_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ def _internal_on_connect(self, client, userdata, flags, rc):
# If response code(rc) is 0 then connection was succesfull.
if rc != 0 and connection_error is None:
self.log.warning(
f"Unknown connection error: ID={rc}."
"Kindly use https://github.com/pschmitt/roombapy/issues/new"
"Unknown connection error: ID=%s."
"Kindly use https://github.com/pschmitt/roombapy/issues/new",
rc,
)
connection_error = "UNKNOWN_ERROR"
if self.on_connect is not None:
Expand All @@ -137,8 +138,9 @@ def _internal_on_disconnect(self, client, userdata, rc):
# If response code(rc) is 0 then connection was succesfull.
if rc != 0 and connection_error is None:
self.log.warning(
f"Unknown disconnection error: ID={rc}."
"Kindly use https://github.com/pschmitt/roombapy/issues/new"
"Unknown disconnection error: ID=%s."
"Kindly use https://github.com/pschmitt/roombapy/issues/new",
rc,
)
connection_error = "UNKNOWN_ERROR"
if self.on_disconnect is not None:
Expand Down
18 changes: 8 additions & 10 deletions roombapy/roomba.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def set_preference(self, preference, setting):
tmp = {preference: val}
roomba_command = {"state": tmp}
str_command = orjson.dumps(roomba_command).decode("utf-8")
self.log.debug("Publishing Roomba Setting : %s" % str_command)
self.log.debug("Publishing Roomba Setting : %s", str_command)
self.remote_client.publish("delta", str_command)

def dict_merge(self, dct, merge_dct):
Expand All @@ -248,7 +248,7 @@ def dict_merge(self, dct, merge_dct):
:param merge_dct: dct merged into dct
:return: None
"""
for k, v in merge_dct.items():
for k in merge_dct:
if (
k in dct
and isinstance(dct[k], dict)
Expand Down Expand Up @@ -376,10 +376,8 @@ def update_state_machine(self, new_state=None):
]
== "none"
and self.cleanMissionStatus_phase == "charge"
and (
self.current_state == ROOMBA_STATES["pause"]
or self.current_state == ROOMBA_STATES["recharge"]
)
and self.current_state
in (ROOMBA_STATES["pause"], ROOMBA_STATES["recharge"])
):
self.current_state = ROOMBA_STATES["cancelled"]
except KeyError:
Expand Down Expand Up @@ -430,14 +428,14 @@ def update_state_machine(self, new_state=None):
# so that we will draw map and can update charge status
current_mission = None
elif (
self.current_state == ROOMBA_STATES["stop"]
or self.current_state == ROOMBA_STATES["pause"]
self.current_state
in (ROOMBA_STATES["stop"], ROOMBA_STATES["pause"])
) and self.cleanMissionStatus_phase == "hmUsrDock":
self.current_state = ROOMBA_STATES["cancelled"]
elif (
(
self.current_state == ROOMBA_STATES["hmUsrDock"]
or self.current_state == ROOMBA_STATES["cancelled"]
self.current_state
in (ROOMBA_STATES["hmUsrDock"], ROOMBA_STATES["cancelled"])
)
and self.cleanMissionStatus_phase == "charge"
or (
Expand Down

0 comments on commit 4c051ff

Please sign in to comment.