diff --git a/roborock/devices/traits/v1/wash_towel_mode.py b/roborock/devices/traits/v1/wash_towel_mode.py index 909e96b6..a97ae6cb 100644 --- a/roborock/devices/traits/v1/wash_towel_mode.py +++ b/roborock/devices/traits/v1/wash_towel_mode.py @@ -43,6 +43,8 @@ def wash_towel_mode_options(self) -> list[WashTowelModes]: async def set_wash_towel_mode(self, mode: WashTowelModes) -> None: """Set the wash towel mode.""" await self.rpc_channel.send_command(RoborockCommand.SET_WASH_TOWEL_MODE, params={"wash_mode": mode.code}) + # Optimistic update to avoid an extra refresh + self.wash_mode = mode async def start_wash(self) -> None: """Start washing the mop.""" diff --git a/tests/devices/traits/v1/test_wash_towel_mode.py b/tests/devices/traits/v1/test_wash_towel_mode.py index 8395c70c..637992c6 100644 --- a/tests/devices/traits/v1/test_wash_towel_mode.py +++ b/tests/devices/traits/v1/test_wash_towel_mode.py @@ -89,6 +89,7 @@ async def test_set_wash_towel_mode( mock_rpc_channel.send_command.assert_called_with( RoborockCommand.SET_WASH_TOWEL_MODE, params={"wash_mode": wash_mode.code} ) + assert wash_towel_mode.wash_mode == wash_mode @pytest.mark.parametrize(