From 8fce2f73774cfbec1d3d6d6634572c18e2987bb8 Mon Sep 17 00:00:00 2001 From: cptntrps <50712262+cptntrps@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:42:08 -0500 Subject: [PATCH] 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. --- roborock/roborock_typing.py | 2 ++ tests/devices/traits/v1/test_command.py | 26 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/roborock/roborock_typing.py b/roborock/roborock_typing.py index 37cdf4d9d..d310248e6 100644 --- a/roborock/roborock_typing.py +++ b/roborock/roborock_typing.py @@ -77,6 +77,7 @@ class RoborockCommand(str, Enum): GET_CHILD_LOCK_STATUS = "get_child_lock_status" GET_CLEAN_FOLLOW_GROUND_MATERIAL_STATUS = "get_clean_follow_ground_material_status" GET_CLEAN_MOTOR_MODE = "get_clean_motor_mode" + GET_CLEAN_DETAIL = "get_clean_detail" GET_CLEAN_RECORD = "get_clean_record" GET_CLEAN_RECORD_MAP = "get_clean_record_map" GET_CLEAN_SEQUENCE = "get_clean_sequence" @@ -123,6 +124,7 @@ class RoborockCommand(str, Enum): GET_RECOVER_MAP = "get_recover_map" GET_RECOVER_MAPS = "get_recover_maps" GET_ROOM_MAPPING = "get_room_mapping" + GET_RT_CLEAN_DETAIL = "get_rt_clean_detail" GET_SCENES_VALID_TIDS = "get_scenes_valid_tids" GET_SEGMENT_STATUS = "get_segment_status" GET_SERIAL_NUMBER = "get_serial_number" diff --git a/tests/devices/traits/v1/test_command.py b/tests/devices/traits/v1/test_command.py index 972f06153..baa38cb1b 100644 --- a/tests/devices/traits/v1/test_command.py +++ b/tests/devices/traits/v1/test_command.py @@ -59,3 +59,29 @@ async def test_send_command_propagates_exception(command_trait: CommandTrait) -> # Verify the exception is propagated with pytest.raises(RoborockException, match="Communication error"): await command_trait.send(RoborockCommand.APP_START) + + +@pytest.mark.parametrize( + ("command", "params"), + [ + (RoborockCommand.GET_RT_CLEAN_DETAIL, {"type": 0, "from": 0}), + (RoborockCommand.GET_CLEAN_DETAIL, {"begin": 1794867592, "type": 0, "id": 0, "from": 0}), + ], +) +async def test_send_clean_detail(command_trait: CommandTrait, command: RoborockCommand, params: dict) -> None: + """Test the clean timeline commands with the parameters a Saros 10R accepts.""" + mock_rpc_channel = command_trait._rpc_channel + assert mock_rpc_channel is not None + response = { + "begin": 1794867592, + "from": 0, + "num": 1, + "more": 0, + "events": [{"t": 1794867611, "i": 41, "e": '{"2":8}'}], + } + mock_rpc_channel.send_command.return_value = response + + result = await command_trait.send(command, params) + + assert result == response + mock_rpc_channel.send_command.assert_called_once_with(command, params=params)