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/roborock_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
26 changes: 26 additions & 0 deletions tests/devices/traits/v1/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)