Skip to content
Open
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
2 changes: 2 additions & 0 deletions roborock/data/b01_q10/b01_q10_code_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class B01_Q10_DP(RoborockModeEnum):
# yet known. They are intentionally left unmapped; ``decode_rpc_response``
# silently ignores unknown codes via ``from_code_optional``, so they do not
# produce "not a valid code" warnings. Map them here once identified.
UNKNOWN_112 = ("dpUnknown112", 112)
UNKNOWN_113 = ("dpUnknown113", 113)
STATUS = ("dpStatus", 121)
BATTERY = ("dpBattery", 122)
FAN_LEVEL = ("dpFanLevel", 123) # NOTE: typo "dpfunLevel" in source code
Expand Down
4 changes: 2 additions & 2 deletions tests/data/test_code_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def test_from_code_optional_does_not_warn(caplog: pytest.LogCaptureFixture) -> N
completed_warnings.discard("112 is not a valid code for B01_Q10_DP")
completed_warnings.discard("113 is not a valid code for B01_Q10_DP")
with caplog.at_level(logging.WARNING):
assert B01_Q10_DP.from_code_optional(112) is None
assert B01_Q10_DP.from_code_optional(113) is None
assert B01_Q10_DP.from_code_optional(112) == B01_Q10_DP.UNKNOWN_112
assert B01_Q10_DP.from_code_optional(113) == B01_Q10_DP.UNKNOWN_113
assert "not a valid code" not in caplog.text


Expand Down
2 changes: 2 additions & 0 deletions tests/protocols/test_b01_q10_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def test_decode_unknown_dps_code(caplog: pytest.LogCaptureFixture) -> None:
decoded_message = decode_rpc_response(message)
assert decoded_message == {
B01_Q10_DP.BATTERY: 100,
B01_Q10_DP.UNKNOWN_112: 0,
B01_Q10_DP.UNKNOWN_113: 0,
}
assert "not a valid code" not in caplog.text

Expand Down
Loading