Skip to content
Draft
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
52 changes: 49 additions & 3 deletions docs/V1_API_COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,13 +707,15 @@ Parameters:

### get_carpet_clean_mode

Description: Get carpet clean mode.
Description: Get carpet clean mode. The carpet first (0x08) and cross carpet (0x20) bits are not here, they are in
`switch_status` of [get_prop](#get_prop).

Parameters:

Returns:

carpet_clean_mode: Enumeration for carpet clean mode.
carpet_clean_mode: 0 avoid, 1 self adaption, 2 vacuum and mop, 3 dynamic adaption (1 and 3 are
"vacuum only" in the app).

Return example:

Expand All @@ -723,13 +725,54 @@ Return example:

Source: Roborock S7 MaxV Ultra

**Supported devices:**

* Roborock Saros 10R: ✅

### set_carpet_clean_mode

Description:
Description: Set carpet clean mode. The app sends it as an object, not a list.

Parameters:

carpet_clean_mode: 0 avoid, 1 self adaption, 2 vacuum and mop, 3 dynamic adaption. The app writes 3 for
"vacuum only" when the robot supports dynamic adaption, else 1.

Cross carpet is a separate flag, set with [app_set_cross_carpet_cleaning_status](#app_set_cross_carpet_cleaning_status).
Write test on Roborock Saros 10R (2026-11-24): setting 0 (avoid) or 2 (vacuum and mop) clears the cross flag by
itself. Setting 3 does not clear it, so cross stays on and must be turned off with
`app_set_cross_carpet_cleaning_status` status 0 (only on robots that support custom carpet clean). Setting 0 left
carpet boost and carpet deep clean unchanged.

Parameter example:

```json
{"carpet_clean_mode": 3}
```

**Supported devices:**

* Roborock Saros 10R: ✅

### app_set_cross_carpet_cleaning_status

Description: Turn the cross carpet mode on or off. It is read back from the 0x20 bit of `switch_status` in
[get_prop](#get_prop).

Parameters:

status: 1 on, 0 off.

Parameter example:

```json
{"status": 1}
```

**Supported devices:**

* Roborock Saros 10R: ✅

### get_carpet_mode

Description:
Expand Down Expand Up @@ -1638,6 +1681,9 @@ Example:

Comment : This example returns the same as get_status. Initial testing has shown that not all get commands are supported by this method

With `["get_status"]` it returns the status plus `switch_status`, which plain `get_status` lacks. Bit 0x08 is
carpet first and 0x20 is cross carpet. Also seen on Roborock Saros 10R.


### get_turn_server

Expand Down
24 changes: 24 additions & 0 deletions docs/V1_DEVICE_FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,30 @@ These features are determined by hardware capabilities and product variant.

---

### is_self_adaption_carpet_supported
**Derived from:** region (`local_info.location`), product model and `is_carpet_deep_clean_supported`
**Feature:** Self-Adaption Carpet Mode
**Description:** The vacuum detects carpet on its own. In the US region (FCC) this is every model without dynamic adaption; in the EU region (CE) only a fixed set of models (TanosS, TanosSPlus, TopazS, TopazSPlus, TopazSPower, TopazSV). Any other or unknown region assumes it.
**Impact:** Carpet mode is offered as a self-adaption setting.

---

### is_dynamic_adaption_carpet_supported
**Derived from:** region (`local_info.location`), product model and `is_carpet_deep_clean_supported`
**Feature:** Dynamic-Adaption Carpet Mode
**Description:** The vacuum adapts to carpet dynamically while cleaning. In the US region (FCC) only TopazSV, TopazSC, Ultron, UltronSPlus and Pearl; in the EU region (CE) every model without self-adaption that supports carpet deep clean (for example the Saros 10R). Never in other or unknown regions.
**Impact:** Carpet mode is offered as a dynamic-adaption setting.

---

### is_carpet_clean_mode_supported
**Derived from:** region (`local_info.location`), product model and `is_carpet_supported`
**Feature:** Carpet Settings
**Description:** The carpet settings are offered on every model with carpet support, except TanosSLite in the US region (compared with the app plugin). An unknown region does not count as US.
**Impact:** Carpet mode settings are available.

---

## Dock Features

Dock capabilities are not part of `DeviceFeatures`. `RoborockDockFeatures.from_dock_type(dock_type, has_am)` derives
Expand Down
12 changes: 11 additions & 1 deletion roborock/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,17 @@ def update_docs(data_file: str, output_file: str):

product_features_map = {}
all_feature_names = set()
v1_feature_names = {feature.name for feature in fields(DeviceFeatures) if feature.type is bool}
# These carpet features depend on the region, which the catalogue does not record.
region_derived = {
"is_self_adaption_carpet_supported",
"is_dynamic_adaption_carpet_supported",
"is_carpet_clean_mode_supported",
}
v1_feature_names = {
feature.name
for feature in fields(DeviceFeatures)
if feature.type is bool and feature.name not in region_derived
}

# Process the combined data to build the feature map
for model, data in combined_product_data.items():
Expand Down
1 change: 1 addition & 0 deletions roborock/data/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .dynamic_map import *
from .v1_carpet import *
from .v1_clean_modes import *
from .v1_code_mappings import *
from .v1_containers import *
75 changes: 75 additions & 0 deletions roborock/data/v1/v1_carpet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"""Carpet models and adaption gates for V1 vacuums."""

from dataclasses import dataclass
from enum import StrEnum

from roborock.data.code_mappings import RoborockEnum
from roborock.data.code_mappings import RoborockProductNickname as Product
from roborock.data.containers import RoborockBase

__all__ = ["CarpetCleanMode", "CarpetMode", "SwitchStatus", "carpet_adaption_support", "carpet_clean_mode_support"]

# "us" is FCC, "de" is CE.
_FCC_DYNAMIC_PRODUCTS = {Product.TOPAZSV, Product.TOPAZSC, Product.ULTRON, Product.ULTRONSPLUS, Product.PEARL}
_CE_SELF_PRODUCTS = {
Product.TANOSS,
Product.TANOSSPLUS,
Product.TOPAZS,
Product.TOPAZSPLUS,
Product.TOPAZSPOWER,
Product.TOPAZSV,
}


def carpet_adaption_support(
location: str | None, product: Product | None, deep_clean_supported: bool
) -> tuple[bool, bool]:
"""Return (self_adaption, dynamic_adaption) carpet support for a region and model."""
if location == "us":
dynamic = product in _FCC_DYNAMIC_PRODUCTS
return not dynamic, dynamic
if location == "de":
self_adaption = product in _CE_SELF_PRODUCTS
return self_adaption, not self_adaption and deep_clean_supported
return True, False


def carpet_clean_mode_support(location: str | None, product: Product | None, carpet_supported: bool) -> bool:
"""Return whether carpet settings are offered; they are hidden on the TanosSLite in the US."""
return carpet_supported and not (location == "us" and product == Product.TANOSSLITE)


class CarpetCleanMode(RoborockEnum):
"""Carpet clean mode codes of the robot."""

unknown = -1
avoid = 0
self_adaption = 1
vac_and_mop = 2
dynamic_adaption = 3


class CarpetMode(StrEnum):
"""Carpet behaviour options exposed to users."""

AVOID = "avoid"
VAC_AND_MOP = "vac_and_mop"
VACUUM_ONLY = "vacuum_only"
CROSS = "cross"


@dataclass
class SwitchStatus(RoborockBase):
"""Bit flags from the `switch_status` of `get_prop ["get_status"]`."""

switch_status: int | None = None

@property
def carpet_first(self) -> bool:
"""Whether carpets are cleaned first."""
return bool((self.switch_status or 0) & 0x08)

@property
def cross_carpet(self) -> bool:
"""Whether the robot may cross carpets."""
return bool((self.switch_status or 0) & 0x20)
18 changes: 16 additions & 2 deletions roborock/device_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from roborock.data.code_mappings import RoborockProductNickname
from roborock.data.containers import RoborockBase, _decamelize
from roborock.data.v1 import RoborockDockTypeCode
from roborock.data.v1 import RoborockDockTypeCode, carpet_adaption_support, carpet_clean_mode_support


class NewFeatureStrBit(IntEnum):
Expand Down Expand Up @@ -592,6 +592,11 @@ class DeviceFeatures(RoborockBase):
metadata={"product_features": [ProductFeatures.MOP_SHAKE_MODULE, ProductFeatures.MOP_SPIN_MODULE]}
)

# Derived from the region, model and carpet support bits
is_self_adaption_carpet_supported: bool
is_dynamic_adaption_carpet_supported: bool
is_carpet_clean_mode_supported: bool

# Raw feature info values from get_init_status for diagnostics
new_feature_info: int = field(default=0, repr=False)
new_feature_info_str: str = field(default="", repr=False)
Expand All @@ -604,12 +609,14 @@ def from_feature_flags(
new_feature_info_str: str,
feature_info: list[int],
product_nickname: RoborockProductNickname | None,
location: str | None = None,
) -> Self:
"""Creates a DeviceFeatures instance from raw feature flags.
:param new_feature_info: A int from get_init_status (sometimes can be found in homedata, but it is not always)
:param new_feature_info_str: A hex string from get_init_status or home_data.
:param feature_info: A list of ints from get_init_status
:param product_nickname: The product nickname of the device."""
:param product_nickname: The product nickname of the device.
:param location: The region code from get_init_status local_info (for example "us" or "de")."""
# For any future reverse engineerining:
# RobotNewFeatures = new_feature_info
# newFeatureInfoStr = new_feature_info_str
Expand Down Expand Up @@ -687,6 +694,13 @@ def from_feature_flags(
kwargs["is_support_water_mode"] |= kwargs["is_roller_mop_supported"]
kwargs["is_customized_clean_supported"] |= kwargs["is_roller_mop_supported"]

kwargs["is_self_adaption_carpet_supported"], kwargs["is_dynamic_adaption_carpet_supported"] = (
carpet_adaption_support(location, product_nickname, kwargs["is_carpet_deep_clean_supported"])
)
kwargs["is_carpet_clean_mode_supported"] = carpet_clean_mode_support(
location, product_nickname, kwargs["is_carpet_supported"]
)

return cls(**kwargs)

@classmethod
Expand Down
11 changes: 11 additions & 0 deletions roborock/devices/traits/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@

from . import (
camera,
carpet_clean_mode,
child_lock,
clean_summary,
collision_avoidance,
Expand Down Expand Up @@ -104,6 +105,7 @@
wash_towel_mode,
)
from .camera import CameraTrait
from .carpet_clean_mode import CarpetCleanModeTrait
from .child_lock import ChildLockTrait
from .clean_summary import CleanSummaryTrait
from .collision_avoidance import CollisionAvoidanceModeTrait, CollisionAvoidanceTrait
Expand Down Expand Up @@ -136,6 +138,7 @@
__all__ = [
"PropertiesApi",
"camera",
"carpet_clean_mode",
"child_lock",
"clean_summary",
"collision_avoidance",
Expand Down Expand Up @@ -202,6 +205,7 @@ class PropertiesApi(Trait):
obstacle_photos: ObstaclePhotoTrait | None = None
mop_dryer: MopDryerTrait | None = None
customize_clean_mode: CustomizeCleanModeTrait | None = None
carpet_clean_mode: CarpetCleanModeTrait | None = None

def __init__(
self,
Expand Down Expand Up @@ -336,6 +340,13 @@ async def discover_features(self) -> None:
collision_avoidance._rpc_channel = self._get_rpc_channel(collision_avoidance)
self.collision_avoidance = collision_avoidance

if self.carpet_clean_mode is None and self._is_supported(
CarpetCleanModeTrait, "carpet_clean_mode", dock_features
):
carpet_clean_mode = CarpetCleanModeTrait(self.device_features)
carpet_clean_mode._rpc_channel = self._get_rpc_channel(carpet_clean_mode) # type: ignore[assignment]
self.carpet_clean_mode = carpet_clean_mode

if self.obstacle_photos is None and self._is_supported(ObstaclePhotoTrait, "obstacle_photos", dock_features):
obstacle_photos = ObstaclePhotoTrait(self._rpc_channel)
obstacle_photos._rpc_channel = self._get_rpc_channel(obstacle_photos)
Expand Down
Loading
Loading