Skip to content

Commit

Permalink
fix: add some new roborock codes and add custom command
Browse files Browse the repository at this point in the history
  • Loading branch information
Lash-L committed Nov 10, 2024
1 parent 2731bce commit f88fb3f
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 35 deletions.
154 changes: 123 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ keywords = ["roborock", "vacuum", "homeassistant"]
roborock = "roborock.cli:main"

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.11"
click = ">=8"
aiohttp = "^3.8.2"
async-timeout = "*"
Expand All @@ -30,6 +30,7 @@ pycryptodomex = {version = "^3.18", markers = "sys_platform == 'darwin'"}
paho-mqtt = "^1.6.1"
dacite = "^1.8.0"
construct = "^2.10.57"
vacuum-map-parser-roborock = "*"


[build-system]
Expand Down
20 changes: 20 additions & 0 deletions roborock/code_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@ class RoborockFanSpeedQ7Max(RoborockFanPowerCode):
max = 104


class RoborockFanSpeedQRevoMaster(RoborockFanPowerCode):
quiet = 101
balanced = 102
turbo = 103
max = 104
max_plus = 105
custom = 110 # Smartplan


class RoborockFanSpeedP10(RoborockFanPowerCode):
off = 105
quiet = 101
Expand Down Expand Up @@ -318,6 +327,17 @@ class RoborockMopIntensityV2(RoborockMopIntensityCode):
custom = 207


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

off = 200
low = 201
medium = 202
high = 203
custom_water_flow = 207
custom = 209 # SmartPlan


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

Expand Down
1 change: 1 addition & 0 deletions roborock/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
ROBOROCK_Q7 = "roborock.vacuum.a40"
ROBOROCK_Q7_MAX = "roborock.vacuum.a38"
ROBOROCK_Q7PLUS = "roborock.vacuum.a40"
ROBOROCK_QREVO_MASTER = "roborock.vacuum.a117"
ROBOROCK_Q8_MAX = "roborock.vacuum.a73"
ROBOROCK_G10S_PRO = "roborock.vacuum.a26"
ROBOROCK_G10S = "roborock.vacuum.a46"
Expand Down
10 changes: 10 additions & 0 deletions roborock/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
RoborockFanPowerCode,
RoborockFanSpeedP10,
RoborockFanSpeedQ7Max,
RoborockFanSpeedQRevoMaster,
RoborockFanSpeedS6Pure,
RoborockFanSpeedS7,
RoborockFanSpeedS7MaxV,
Expand All @@ -30,6 +31,7 @@
RoborockInCleaning,
RoborockMopIntensityCode,
RoborockMopIntensityP10,
RoborockMopIntensityQRevoMaster,
RoborockMopIntensityS5Max,
RoborockMopIntensityS6MaxV,
RoborockMopIntensityS7,
Expand All @@ -51,6 +53,7 @@
ROBOROCK_G10S_PRO,
ROBOROCK_P10,
ROBOROCK_Q7_MAX,
ROBOROCK_QREVO_MASTER,
ROBOROCK_QREVO_MAXV,
ROBOROCK_QREVO_PRO,
ROBOROCK_QREVO_S,
Expand Down Expand Up @@ -515,6 +518,12 @@ class Q7MaxStatus(Status):
water_box_mode: RoborockMopIntensityV2 | None = None


@dataclass
class QRevoMasterStatus(Status):
fan_power: RoborockFanSpeedQRevoMaster | None = None
water_box_mode: RoborockMopIntensityQRevoMaster | None = None


@dataclass
class S6MaxVStatus(Status):
fan_power: RoborockFanSpeedS7MaxV | None = None
Expand Down Expand Up @@ -572,6 +581,7 @@ class S8MaxvUltraStatus(Status):
ROBOROCK_S4_MAX: S4MaxStatus,
ROBOROCK_S5_MAX: S5MaxStatus,
ROBOROCK_Q7_MAX: Q7MaxStatus,
ROBOROCK_QREVO_MASTER: QRevoMasterStatus,
ROBOROCK_S6: S6PureStatus,
ROBOROCK_S6_MAXV: S6MaxVStatus,
ROBOROCK_S6_PURE: S6PureStatus,
Expand Down
1 change: 1 addition & 0 deletions roborock/roborock_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class RoborockCommand(str, Enum):
GET_MAP_STATUS = "get_map_status"
GET_MAP_V1 = "get_map_v1"
GET_MAP_V2 = "get_map_v2"
GET_MAP_CALIBRATION = "get_map_calibration" # Custom command
GET_MOP_MOTOR_STATUS = "get_mop_motor_status"
GET_MOP_TEMPLATE_PARAMS_BY_ID = "get_mop_template_params_by_id"
GET_MOP_TEMPLATE_PARAMS_SUMMARY = "get_mop_template_params_summary"
Expand Down
8 changes: 6 additions & 2 deletions roborock/version_1_apis/roborock_client_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@
)
from roborock.util import RepeatableTask, unpack_list

COMMANDS_SECURED = [
COMMANDS_SECURED = {
RoborockCommand.GET_MAP_V1,
RoborockCommand.GET_MULTI_MAP,
]
}

CUSTOM_COMMANDS = {RoborockCommand.GET_MAP_CALIBRATION}

CLOUD_REQUIRED = COMMANDS_SECURED.union(CUSTOM_COMMANDS)

WASH_N_FILL_DOCK = [
RoborockDockTypeCode.empty_wash_fill_dock,
Expand Down
Loading

0 comments on commit f88fb3f

Please sign in to comment.