Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vacuum: skip pausing on s50 and s6 maxv before return home call #933

Merged
merged 2 commits into from
Mar 8, 2021
Merged
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
24 changes: 18 additions & 6 deletions miio/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class WaterFlow(enum.Enum):


ROCKROBO_V1 = "rockrobo.vacuum.v1"
ROCKROBO_S5 = "roborock.vacuum.s5"
ROCKROBO_S6_MAXV = "roborock.vacuum.a10"


class Vacuum(Device):
Expand Down Expand Up @@ -144,7 +146,17 @@ def resume_or_start(self):
@command()
def home(self):
"""Stop cleaning and return home."""
self.send("app_pause")
if self.model is None:
self._autodetect_model()

SKIP_PAUSE = [
ROCKROBO_S5,
ROCKROBO_S6_MAXV,
]

if self.model not in SKIP_PAUSE:
self.send("app_pause")

return self.send("app_charge")

@command(click.argument("x_coord", type=int), click.argument("y_coord", type=int))
Expand Down Expand Up @@ -511,12 +523,12 @@ def _autodetect_model(self):
# cloud-blocked vacuums will not return proper payloads
self._fanspeeds = FanspeedV1
self.model = ROCKROBO_V1
_LOGGER.debug("Unable to query model, falling back to %s", self._fanspeeds)
_LOGGER.warning("Unable to query model, falling back to %s", self.model)
return
finally:
_LOGGER.debug("Model: %s", self.model)

_LOGGER.info("model: %s", self.model)

if info.model == ROCKROBO_V1:
if self.model == ROCKROBO_V1:
_LOGGER.debug("Got robov1, checking for firmware version")
fw_version = info.firmware_version
version, build = fw_version.split("_")
Expand All @@ -527,7 +539,7 @@ def _autodetect_model(self):
self._fanspeeds = FanspeedV2
else:
self._fanspeeds = FanspeedV1
elif info.model == "roborock.vacuum.e2":
elif self.model == "roborock.vacuum.e2":
self._fanspeeds = FanspeedE2
else:
self._fanspeeds = FanspeedV2
Expand Down