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
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
9 changes: 9 additions & 0 deletions roborock/code_mappings.py
Original file line number Diff line number Diff line change
@@ -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."""

2 changes: 2 additions & 0 deletions roborock/const.py
Original file line number Diff line number Diff line change
@@ -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
@@ -51,5 +52,6 @@
ROBOROCK_S8,
ROBOROCK_S4_MAX,
ROBOROCK_S7,
ROBOROCK_P10,
]
)
21 changes: 21 additions & 0 deletions roborock/containers.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
RoborockDockWashTowelModeCode,
RoborockErrorCode,
RoborockFanPowerCode,
RoborockFanSpeedP10,
RoborockFanSpeedQ7Max,
RoborockFanSpeedS6Pure,
RoborockFanSpeedS7,
@@ -32,6 +33,7 @@
FILTER_REPLACE_TIME,
MAIN_BRUSH_REPLACE_TIME,
ROBOROCK_G10S_PRO,
ROBOROCK_P10,
ROBOROCK_Q7_MAX,
ROBOROCK_S4_MAX,
ROBOROCK_S5_MAX,
@@ -282,6 +284,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
@@ -345,6 +357,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[RoborockMopModeS8ProUltra] = None


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


@@ -378,6 +398,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