Skip to content
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
6 changes: 5 additions & 1 deletion roborock/data/dyad/dyad_code_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ class DyadMode(RoborockEnum):


class DyadCleanMode(RoborockEnum):
unknown = -1
auto = 1
max = 2
dehydration = 3
dehydration = 3 # The F25 Ultra reports its "Sponge" mode with this code.
power_saving = 4
# Heated modes on the F25 Ultra, confirmed by switching modes on the device.
hot_water = 5
steam = 6


class DyadSuction(RoborockEnum):
Expand Down
1 change: 0 additions & 1 deletion tests/conformance/test_enum_conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# As these enums are remediated, remove them from this baseline.
KNOWN_ENUMS_MISSING_UNKNOWN = {
"roborock.data.dyad.dyad_code_mappings.DyadBrushSpeed",
"roborock.data.dyad.dyad_code_mappings.DyadCleanMode",
"roborock.data.dyad.dyad_code_mappings.DyadCleanser",
"roborock.data.dyad.dyad_code_mappings.DyadError",
"roborock.data.dyad.dyad_code_mappings.DyadMode",
Expand Down
25 changes: 24 additions & 1 deletion tests/data/test_code_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from roborock import CleanRoutes, HomeDataProduct, RoborockCategory
from roborock.data.b01_q10.b01_q10_code_mappings import B01_Q10_DP, YXCleanType
from roborock.data.code_mappings import completed_warnings
from roborock.data.dyad.dyad_code_mappings import DyadError
from roborock.data.dyad.dyad_code_mappings import DyadCleanMode, DyadError
from roborock.data.v1.v1_code_mappings import (
RoborockErrorCode,
RoborockFinishReason,
Expand Down Expand Up @@ -170,3 +170,26 @@ def test_roborock_mode_enum_display_names_group_duplicate_protocol_codes() -> No
assert CleanRoutes.DEEP_PLUS_CN.display_name == "deep_plus"
assert CleanRoutes.keys().count("deep_plus") == 1
assert "deep_plus_cn" not in CleanRoutes.keys()


@pytest.mark.parametrize(
"code, expected",
[
# Codes reported by an F25 Ultra when switching modes in the app.
(1, DyadCleanMode.auto),
(3, DyadCleanMode.dehydration), # "Sponge" on the F25 Ultra
(5, DyadCleanMode.hot_water),
(6, DyadCleanMode.steam),
],
)
def test_dyad_clean_mode_codes(code: int, expected: DyadCleanMode, caplog: pytest.LogCaptureFixture) -> None:
"""Dyad clean mode codes reported by devices decode without warnings."""
completed_warnings.clear()
with caplog.at_level(logging.WARNING):
assert DyadCleanMode(code) == expected
assert "Missing DyadCleanMode" not in caplog.text


def test_dyad_clean_mode_unknown_code() -> None:
"""An unrecognized Dyad clean mode falls back to 'unknown' instead of 'auto'."""
assert DyadCleanMode(99) == DyadCleanMode.unknown
Loading