Skip to content

Commit 8fce2f7

Browse files
committed
feat: add GET_CLEAN_DETAIL and GET_RT_CLEAN_DETAIL commands
get_rt_clean_detail returns the event timeline of the current or last run; get_clean_detail returns it for a past run, selected by its begin time.
1 parent 109f433 commit 8fce2f7

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎roborock/roborock_typing.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class RoborockCommand(str, Enum):
7777
GET_CHILD_LOCK_STATUS = "get_child_lock_status"
7878
GET_CLEAN_FOLLOW_GROUND_MATERIAL_STATUS = "get_clean_follow_ground_material_status"
7979
GET_CLEAN_MOTOR_MODE = "get_clean_motor_mode"
80+
GET_CLEAN_DETAIL = "get_clean_detail"
8081
GET_CLEAN_RECORD = "get_clean_record"
8182
GET_CLEAN_RECORD_MAP = "get_clean_record_map"
8283
GET_CLEAN_SEQUENCE = "get_clean_sequence"
@@ -123,6 +124,7 @@ class RoborockCommand(str, Enum):
123124
GET_RECOVER_MAP = "get_recover_map"
124125
GET_RECOVER_MAPS = "get_recover_maps"
125126
GET_ROOM_MAPPING = "get_room_mapping"
127+
GET_RT_CLEAN_DETAIL = "get_rt_clean_detail"
126128
GET_SCENES_VALID_TIDS = "get_scenes_valid_tids"
127129
GET_SEGMENT_STATUS = "get_segment_status"
128130
GET_SERIAL_NUMBER = "get_serial_number"

‎tests/devices/traits/v1/test_command.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,29 @@ async def test_send_command_propagates_exception(command_trait: CommandTrait) ->
5959
# Verify the exception is propagated
6060
with pytest.raises(RoborockException, match="Communication error"):
6161
await command_trait.send(RoborockCommand.APP_START)
62+
63+
64+
@pytest.mark.parametrize(
65+
("command", "params"),
66+
[
67+
(RoborockCommand.GET_RT_CLEAN_DETAIL, {"type": 0, "from": 0}),
68+
(RoborockCommand.GET_CLEAN_DETAIL, {"begin": 1794867592, "type": 0, "id": 0, "from": 0}),
69+
],
70+
)
71+
async def test_send_clean_detail(command_trait: CommandTrait, command: RoborockCommand, params: dict) -> None:
72+
"""Test the clean timeline commands with the parameters a Saros 10R accepts."""
73+
mock_rpc_channel = command_trait._rpc_channel
74+
assert mock_rpc_channel is not None
75+
response = {
76+
"begin": 1794867592,
77+
"from": 0,
78+
"num": 1,
79+
"more": 0,
80+
"events": [{"t": 1794867611, "i": 41, "e": '{"2":8}'}],
81+
}
82+
mock_rpc_channel.send_command.return_value = response
83+
84+
result = await command_trait.send(command, params)
85+
86+
assert result == response
87+
mock_rpc_channel.send_command.assert_called_once_with(command, params=params)

0 commit comments

Comments
 (0)