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

feat: add q revo/p10 support #114

Merged
merged 7 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
16 changes: 16 additions & 0 deletions roborock/code_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ class RoborockFanSpeedQ7Max(RoborockFanPowerCode):
max = 104


class RoborockFanSpeedP10(RoborockFanPowerCode):
off = 105
quiet = 101
balanced = 102
turbo = 103
max = 104
max_plus = 108


class RoborockMopModeCode(RoborockEnum):
"""Describes the mop mode of the vacuum cleaner."""

Expand All @@ -193,6 +202,13 @@ class RoborockMopModeS8ProUltra(RoborockMopModeCode):
custom = 302


class RoborockMopModeP10(RoborockMopModeCode):
"""Describes the mop mode of the vacuum cleaner."""

standard = 300
fast = 304


class RoborockMopIntensityCode(RoborockEnum):
"""Describes the mop intensity of the vacuum cleaner."""

Expand Down
2 changes: 2 additions & 0 deletions roborock/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
ROBOROCK_C1 = "roborock.vacuum.c1"
ROBOROCK_S8_PRO_ULTRA = "roborock.vacuum.a70"
ROBOROCK_S8 = "roborock.vacuum.a51"
ROBOROCK_P10 = "roborock.vacuum.a75"

SUPPORTED_VACUUMS = (
[ # These are the devices that show up when you add a device - more could be supported and just not show up
Expand All @@ -51,5 +52,6 @@
ROBOROCK_S8,
ROBOROCK_S4_MAX,
ROBOROCK_S7,
ROBOROCK_P10,
]
)
22 changes: 22 additions & 0 deletions roborock/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
RoborockFanSpeedS6Pure,
RoborockFanSpeedS7,
RoborockFanSpeedS7MaxV,
RoborockFanSpeedP10,
RoborockMopIntensityCode,
RoborockMopIntensityS7,
RoborockMopIntensityV2,
RoborockMopModeCode,
RoborockMopModeS7,
RoborockMopModeS8ProUltra,
RoborockMopModeP10,
RoborockStateCode,
)
from .const import (
Expand All @@ -42,6 +44,7 @@
ROBOROCK_S7_MAXV,
ROBOROCK_S8,
ROBOROCK_S8_PRO_ULTRA,
ROBOROCK_P10,
SENSOR_DIRTY_REPLACE_TIME,
SIDE_BRUSH_REPLACE_TIME,
)
Expand Down Expand Up @@ -282,6 +285,16 @@ class Status(RoborockBase):
charge_status: Optional[int] = None
unsave_map_reason: Optional[int] = None
unsave_map_flag: Optional[int] = None
wash_status: Optional[int] = None
distance_off: Optional[int] = None
in_warmup: Optional[int] = None
dry_status: Optional[int] = None
rdt: Optional[int] = None
clean_percent: Optional[int] = None
rss: Optional[int] = None
dss: Optional[int] = None
common_status: Optional[int] = None
corner_clean_mode: Optional[int] = None

def __post_init__(self) -> None:
self.square_meter_clean_area = round(self.clean_area / 1000000, 1) if self.clean_area is not None else None
Expand Down Expand Up @@ -345,6 +358,13 @@ class S8Status(Status):
mop_mode: Optional[RoborockMopModeS8ProUltra] = None


@dataclass
class P10Status(Status):
fan_power: Optional[RoborockFanSpeedP10] = None
water_box_mode: Optional[RoborockMopIntensityV2] = None
mop_mode: Optional[RoborockMopModeP10] = None


ModelStatus: dict[str, Type[Status]] = {
ROBOROCK_S4_MAX: S4MaxStatus,
ROBOROCK_S5_MAX: S5MaxStatus,
Expand All @@ -357,6 +377,7 @@ class S8Status(Status):
ROBOROCK_S8: S8Status,
ROBOROCK_S8_PRO_ULTRA: S8ProUltraStatus,
ROBOROCK_G10S_PRO: S7MaxVStatus,
ROBOROCK_P10: P10Status
}


Expand All @@ -378,6 +399,7 @@ class CleanSummary(RoborockBase):
clean_count: Optional[int] = None
dust_collection_count: Optional[int] = None
records: Optional[list[int]] = None
last_clean_t: Optional[int] = None

def __post_init__(self) -> None:
self.square_meter_clean_area = round(self.clean_area / 1000000, 1) if self.clean_area is not None else None
Expand Down