Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions deebot_client/commands/json/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,16 @@ class CleanAreaV2(CleanV2):
"""Clean area command."""

def __init__(self, mode: CleanMode, area: list[int | float], _: int = 1) -> None:
self._additional_content = {
"type": mode.value,
"value": ",".join(str(i) for i in area),
}
if mode == CleanMode.SPOT_AREA:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break many bots as for example my bot does not support freeclean.

We don't can change it like this... We need to extend the capabilities so this command is aware of the model and changes only for the models which need it

self._additional_content = {
"type": CleanMode.FREE_CLEAN.value,
"value": ";".join(("1," + str(i)) for i in area),
}
else:
self._additional_content = {
"type": mode,
"value": ",".join(str(i) for i in area),
}
super().__init__(CleanAction.START)

def _get_args(self, action: CleanAction) -> dict[str, Any]:
Expand Down
1 change: 1 addition & 0 deletions deebot_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class CleanMode(StrEnumWithXml):
AUTO = "auto", "auto"
SPOT_AREA = "spotArea", "SpotArea"
CUSTOM_AREA = "customArea", "spot"
FREE_CLEAN = "freeClean", "freeClean"


@dataclass(frozen=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/json/test_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async def test_Clean_act(
),
(
CleanAreaV2(CleanMode.SPOT_AREA, [5, 8]),
{"act": "start", "content": {"type": "spotArea", "value": "5,8"}},
{"act": "start", "content": {"type": "freeClean", "value": "1,5;1,8"}},
),
(
CleanArea(CleanMode.CUSTOM_AREA, [1580.0, -4087.0, 3833.0, -7525.0]),
Expand Down
Loading