Skip to content

Commit

Permalink
feat: add q revo/p10 support (#114)
Browse files Browse the repository at this point in the history
* feat add Q REVO support (RoborockFanSpeedP10 + RoborockMopModeP10)

* feat add Q REVO support (model ROBOROCK_P10/roborock.vacuum.a75)

* feat add Q REVO support (P10Status)

* feat add Q REVO support (status data)

* fix(P10Status): Change RoborockMopModeP10 by RoborockMopModeS8ProUltra

* fix(RoborockMopModeP10): Remove

* fix: change ordering of imports

---------

Co-authored-by: jalcaras <[email protected]>
Co-authored-by: jalcaras <[email protected]>
Co-authored-by: Luke <[email protected]>
  • Loading branch information
4 people authored Sep 4, 2023
1 parent 0ade537 commit b2237d9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
9 changes: 9 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 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,
]
)
21 changes: 21 additions & 0 deletions roborock/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
RoborockDockWashTowelModeCode,
RoborockErrorCode,
RoborockFanPowerCode,
RoborockFanSpeedP10,
RoborockFanSpeedQ7Max,
RoborockFanSpeedS6Pure,
RoborockFanSpeedS7,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -357,6 +376,7 @@ class S8Status(Status):
ROBOROCK_S8: S8Status,
ROBOROCK_S8_PRO_ULTRA: S8ProUltraStatus,
ROBOROCK_G10S_PRO: S7MaxVStatus,
ROBOROCK_P10: P10Status,
}


Expand All @@ -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
Expand Down

0 comments on commit b2237d9

Please sign in to comment.