Skip to content

Commit 9d53c88

Browse files
committed
fix(v1): update wash towel mode after setting it
WashTowelModeTrait.set_wash_towel_mode sent the command but left wash_mode unchanged, so the trait kept reporting the previous mode until the next refresh. Update wash_mode optimistically after the command, like the other V1 trait setters.
1 parent 109f433 commit 9d53c88

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎roborock/devices/traits/v1/wash_towel_mode.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def wash_towel_mode_options(self) -> list[WashTowelModes]:
4343
async def set_wash_towel_mode(self, mode: WashTowelModes) -> None:
4444
"""Set the wash towel mode."""
4545
await self.rpc_channel.send_command(RoborockCommand.SET_WASH_TOWEL_MODE, params={"wash_mode": mode.code})
46+
# Optimistic update to avoid an extra refresh
47+
self.wash_mode = mode
4648

4749
async def start_wash(self) -> None:
4850
"""Start washing the mop."""

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ async def test_set_wash_towel_mode(
8989
mock_rpc_channel.send_command.assert_called_with(
9090
RoborockCommand.SET_WASH_TOWEL_MODE, params={"wash_mode": wash_mode.code}
9191
)
92+
assert wash_towel_mode.wash_mode == wash_mode
9293

9394

9495
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)