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 some new roborock codes and add custom command #234

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
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
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 @@ -319,6 +328,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 @@ -20,6 +20,7 @@
RoborockFanPowerCode,
RoborockFanSpeedP10,
RoborockFanSpeedQ7Max,
RoborockFanSpeedQRevoMaster,
RoborockFanSpeedS6Pure,
RoborockFanSpeedS7,
RoborockFanSpeedS7MaxV,
Expand All @@ -29,6 +30,7 @@
RoborockMopIntensityCode,
RoborockMopIntensityP10,
RoborockMopIntensityQ7Max,
RoborockMopIntensityQRevoMaster,
RoborockMopIntensityS5Max,
RoborockMopIntensityS6MaxV,
RoborockMopIntensityS7,
Expand All @@ -49,6 +51,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 @@ -570,6 +573,12 @@ class Q7MaxStatus(Status):
water_box_mode: RoborockMopIntensityQ7Max | 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 @@ -627,6 +636,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 @@ -55,10 +55,14 @@
)
from roborock.util import RepeatableTask, get_next_int, 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
Loading