From 2368befe97389e6f4d325be02fab2d7f5400b77d Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 15 Nov 2025 09:34:25 -0800 Subject: [PATCH 1/7] fix: Ensure traits to always reflect the the status of commands This changes the contract for traits that have commands that mutate state to always ensure they reflect the latest device state after the command completes. --- roborock/devices/traits/v1/child_lock.py | 2 + roborock/devices/traits/v1/common.py | 10 +++- roborock/devices/traits/v1/consumeable.py | 1 + roborock/devices/traits/v1/do_not_disturb.py | 4 ++ roborock/devices/traits/v1/flow_led_status.py | 2 + roborock/devices/traits/v1/led_status.py | 2 + .../traits/v1/valley_electricity_timer.py | 3 + roborock/devices/traits/v1/volume.py | 1 + tests/devices/traits/v1/test_consumable.py | 28 ++++++++-- tests/devices/traits/v1/test_dnd.py | 56 +++++++++++++++++-- 10 files changed, 98 insertions(+), 11 deletions(-) diff --git a/roborock/devices/traits/v1/child_lock.py b/roborock/devices/traits/v1/child_lock.py index 769b71c75..192e2a298 100644 --- a/roborock/devices/traits/v1/child_lock.py +++ b/roborock/devices/traits/v1/child_lock.py @@ -19,7 +19,9 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the child lock.""" await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 1}) + self.lock_status = 1 async def disable(self) -> None: """Disable the child lock.""" await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 0}) + self.lock_status = 0 diff --git a/roborock/devices/traits/v1/common.py b/roborock/devices/traits/v1/common.py index b948d9151..a38bcf49f 100644 --- a/roborock/devices/traits/v1/common.py +++ b/roborock/devices/traits/v1/common.py @@ -28,8 +28,14 @@ class V1TraitMixin(ABC): Each trait subclass must define a class variable `command` that specifies the RoborockCommand used to fetch the trait data from the device. The `refresh()` method can be called to update the contents of the trait data - from the device. A trait can also support additional commands for updating - state associated with the trait. + from the device. + + A trait can also support additional commands for updating state associated + with the trait. It is expected that a trait will update it's own internal + state either reflecting the change optimistically or by refreshing the + trait state from the device. In cases where one trait caches data that is + also represented in another trait, it is the responsibility of the caller + to ensure that both traits are refreshed as needed to keep them in sync. The traits typically subclass RoborockBase to provide serialization and deserialization functionality, but this is not strictly required. diff --git a/roborock/devices/traits/v1/consumeable.py b/roborock/devices/traits/v1/consumeable.py index 92df66325..262f47cad 100644 --- a/roborock/devices/traits/v1/consumeable.py +++ b/roborock/devices/traits/v1/consumeable.py @@ -45,3 +45,4 @@ class ConsumableTrait(Consumable, common.V1TraitMixin): async def reset_consumable(self, consumable: ConsumableAttribute) -> None: """Reset a specific consumable attribute on the device.""" await self.rpc_channel.send_command(RoborockCommand.RESET_CONSUMABLE, params=[consumable.value]) + await self.refresh() diff --git a/roborock/devices/traits/v1/do_not_disturb.py b/roborock/devices/traits/v1/do_not_disturb.py index 6ee0c3967..b96e600b9 100644 --- a/roborock/devices/traits/v1/do_not_disturb.py +++ b/roborock/devices/traits/v1/do_not_disturb.py @@ -18,10 +18,12 @@ def is_on(self) -> bool: async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None: """Set the Do Not Disturb (DND) timer settings of the device.""" await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list()) + await self.refresh() async def clear_dnd_timer(self) -> None: """Clear the Do Not Disturb (DND) timer settings of the device.""" await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) + await self.refresh() async def enable(self) -> None: """Set the Do Not Disturb (DND) timer settings of the device.""" @@ -29,7 +31,9 @@ async def enable(self) -> None: RoborockCommand.SET_DND_TIMER, params=self.as_list(), ) + self.enabled = 1 async def disable(self) -> None: """Disable the Do Not Disturb (DND) timer settings of the device.""" await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) + self.enabled = 0 diff --git a/roborock/devices/traits/v1/flow_led_status.py b/roborock/devices/traits/v1/flow_led_status.py index 2735abfbc..0e95c0085 100644 --- a/roborock/devices/traits/v1/flow_led_status.py +++ b/roborock/devices/traits/v1/flow_led_status.py @@ -19,7 +19,9 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the Flow LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 1}) + self.status = 1 async def disable(self) -> None: """Disable the Flow LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 0}) + self.status = 0 diff --git a/roborock/devices/traits/v1/led_status.py b/roborock/devices/traits/v1/led_status.py index 484329790..5009964be 100644 --- a/roborock/devices/traits/v1/led_status.py +++ b/roborock/devices/traits/v1/led_status.py @@ -19,10 +19,12 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_LED_STATUS, params=[1]) + self.status = 1 async def disable(self) -> None: """Disable the LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_LED_STATUS, params=[0]) + self.status = 0 @classmethod def _parse_type_response(cls, response: V1ResponseData) -> LedStatus: diff --git a/roborock/devices/traits/v1/valley_electricity_timer.py b/roborock/devices/traits/v1/valley_electricity_timer.py index d8e0d65ee..4758a6c8e 100644 --- a/roborock/devices/traits/v1/valley_electricity_timer.py +++ b/roborock/devices/traits/v1/valley_electricity_timer.py @@ -23,6 +23,7 @@ async def set_timer(self, timer: ValleyElectricityTimer) -> None: async def clear_timer(self) -> None: """Clear the Valley Electricity Timer settings of the device.""" await self.rpc_channel.send_command(RoborockCommand.CLOSE_VALLEY_ELECTRICITY_TIMER) + await self.refresh() async def enable(self) -> None: """Enable the Valley Electricity Timer settings of the device.""" @@ -30,9 +31,11 @@ async def enable(self) -> None: RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=self.as_list(), ) + self.enabled = 1 async def disable(self) -> None: """Disable the Valley Electricity Timer settings of the device.""" await self.rpc_channel.send_command( RoborockCommand.CLOSE_VALLEY_ELECTRICITY_TIMER, ) + self.enabled = 0 diff --git a/roborock/devices/traits/v1/volume.py b/roborock/devices/traits/v1/volume.py index 4857a3774..865a4b3ba 100644 --- a/roborock/devices/traits/v1/volume.py +++ b/roborock/devices/traits/v1/volume.py @@ -24,3 +24,4 @@ class SoundVolumeTrait(SoundVolume, common.V1TraitMixin): async def set_volume(self, volume: int) -> None: """Set the sound volume of the device.""" await self.rpc_channel.send_command(RoborockCommand.CHANGE_SOUND_VOLUME, params=[volume]) + self.volume = volume diff --git a/tests/devices/traits/v1/test_consumable.py b/tests/devices/traits/v1/test_consumable.py index 388d35040..6f644d9d9 100644 --- a/tests/devices/traits/v1/test_consumable.py +++ b/tests/devices/traits/v1/test_consumable.py @@ -1,6 +1,6 @@ """Tests for the DoNotDisturbTrait class.""" -from unittest.mock import AsyncMock +from unittest.mock import AsyncMock, call import pytest @@ -60,11 +60,29 @@ async def test_reset_consumable_data( reset_param: str, ) -> None: """Test successfully resetting consumable data.""" + mock_rpc_channel.send_command.side_effect = [ + {}, # Response for RESET_CONSUMABLE + # Response for GET_CONSUMABLE after reset + { + "main_brush_work_time": 5555, + "side_brush_work_time": 6666, + "filter_work_time": 7777, + "filter_element_work_time": 8888, + "sensor_dirty_time": 9999, + }, + ] + # Call the method await consumable_trait.reset_consumable(consumable) # Verify the RPC call was made correctly with expected parameters - mock_rpc_channel.send_command.assert_called_once_with(RoborockCommand.RESET_CONSUMABLE, params=[reset_param]) - - -# + assert mock_rpc_channel.send_command.mock_calls == [ + call(RoborockCommand.RESET_CONSUMABLE, params=[reset_param]), + call(RoborockCommand.GET_CONSUMABLE), + ] + # Verify the consumable data was refreshed correctly + assert consumable_trait.main_brush_work_time == 5555 + assert consumable_trait.side_brush_work_time == 6666 + assert consumable_trait.filter_work_time == 7777 + assert consumable_trait.filter_element_work_time == 8888 + assert consumable_trait.sensor_dirty_time == 9999 diff --git a/tests/devices/traits/v1/test_dnd.py b/tests/devices/traits/v1/test_dnd.py index 834d1a6f8..02132ea71 100644 --- a/tests/devices/traits/v1/test_dnd.py +++ b/tests/devices/traits/v1/test_dnd.py @@ -1,12 +1,13 @@ """Tests for the DoNotDisturbTrait class.""" -from unittest.mock import AsyncMock +from unittest.mock import AsyncMock, call import pytest from roborock.data import DnDTimer from roborock.devices.device import RoborockDevice from roborock.devices.traits.v1.do_not_disturb import DoNotDisturbTrait +from roborock.exceptions import RoborockException from roborock.roborock_typing import RoborockCommand @@ -74,27 +75,74 @@ async def test_set_dnd_timer_success( dnd_trait: DoNotDisturbTrait, mock_rpc_channel: AsyncMock, sample_dnd_timer: DnDTimer ) -> None: """Test successfully setting DnD timer settings.""" + mock_rpc_channel.send_command.side_effect = [ + # Response for SET_DND_TIMER + {}, + # Response for GET_DND_TIMER after updating + { + "startHour": 22, + "startMinute": 0, + "endHour": 8, + "endMinute": 0, + "enabled": 1, + }, + ] + # Call the method await dnd_trait.set_dnd_timer(sample_dnd_timer) # Verify the RPC call was made correctly with dataclass converted to dict expected_params = [22, 0, 8, 0] - mock_rpc_channel.send_command.assert_called_once_with(RoborockCommand.SET_DND_TIMER, params=expected_params) + mock_rpc_channel.send_command.mock_calls = [ + call(RoborockCommand.SET_DND_TIMER, params=expected_params), + call(RoborockCommand.GET_DND_TIMER), + ] + + # Verify the trait state is updated + assert dnd_trait.enabled == 1 + assert dnd_trait.is_on + assert dnd_trait.start_hour == 22 + assert dnd_trait.start_minute == 0 + assert dnd_trait.end_hour == 8 + assert dnd_trait.end_minute == 0 async def test_clear_dnd_timer_success(dnd_trait: DoNotDisturbTrait, mock_rpc_channel: AsyncMock) -> None: """Test successfully clearing DnD timer settings.""" + mock_rpc_channel.send_command.side_effect = [ + # Response for CLOSE_DND_TIMER + {}, + # Response for GET_DND_TIMER after clearing + { + "startHour": 0, + "startMinute": 0, + "endHour": 0, + "endMinute": 0, + "enabled": 0, + }, + ] + # Call the method await dnd_trait.clear_dnd_timer() # Verify the RPC call was made correctly - mock_rpc_channel.send_command.assert_called_once_with(RoborockCommand.CLOSE_DND_TIMER) + mock_rpc_channel.send_command.mock_calls = [ + call(RoborockCommand.CLOSE_DND_TIMER), + call(RoborockCommand.GET_DND_TIMER), + ] + + # Verify the trait state is updated + assert dnd_trait.enabled == 0 + assert not dnd_trait.is_on + assert dnd_trait.start_hour == 0 + assert dnd_trait.start_minute == 0 + assert dnd_trait.end_hour == 0 + assert dnd_trait.end_minute == 0 async def test_get_dnd_timer_propagates_exception(dnd_trait: DoNotDisturbTrait, mock_rpc_channel: AsyncMock) -> None: """Test that exceptions from RPC channel are propagated in get_dnd_timer.""" - from roborock.exceptions import RoborockException # Setup mock to raise an exception mock_rpc_channel.send_command.side_effect = RoborockException("Communication error") From 4fed92b6ec142285263eac50cd20996f8d38cf50 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 15 Nov 2025 09:35:43 -0800 Subject: [PATCH 2/7] chore: Update working for the CommandTrait --- roborock/devices/traits/v1/command.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roborock/devices/traits/v1/command.py b/roborock/devices/traits/v1/command.py index 79d54d276..74195dc43 100644 --- a/roborock/devices/traits/v1/command.py +++ b/roborock/devices/traits/v1/command.py @@ -16,7 +16,13 @@ def __post_init__(self) -> None: self._rpc_channel = None async def send(self, command: RoborockCommand | str, params: ParamsType = None) -> Any: - """Send a command to the device.""" + """Send a command to the device. + + Sending a raw command to the device using this method does not update + the internal state of any other traits. It is the responsibility of the + caller to ensure that any traits affected by the command are refreshed + as needed. + """ if not self._rpc_channel: raise ValueError("Device trait in invalid state") return await self._rpc_channel.send_command(command, params=params) From c35bd1901d0b5b44456d81b0eb9468d9b2d78f3b Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 15 Nov 2025 09:42:52 -0800 Subject: [PATCH 3/7] chore: remove unnecessary whitespace --- roborock/devices/traits/v1/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roborock/devices/traits/v1/command.py b/roborock/devices/traits/v1/command.py index 74195dc43..01978b9a5 100644 --- a/roborock/devices/traits/v1/command.py +++ b/roborock/devices/traits/v1/command.py @@ -17,7 +17,7 @@ def __post_init__(self) -> None: async def send(self, command: RoborockCommand | str, params: ParamsType = None) -> Any: """Send a command to the device. - + Sending a raw command to the device using this method does not update the internal state of any other traits. It is the responsibility of the caller to ensure that any traits affected by the command are refreshed From 27ec0177fa373b5ab98d8db50c6c18c39907dfaa Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 15 Nov 2025 10:04:17 -0800 Subject: [PATCH 4/7] fix: Update bad asserts found by co-pilot --- tests/devices/traits/v1/test_dnd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/devices/traits/v1/test_dnd.py b/tests/devices/traits/v1/test_dnd.py index 02132ea71..7c0d49332 100644 --- a/tests/devices/traits/v1/test_dnd.py +++ b/tests/devices/traits/v1/test_dnd.py @@ -94,7 +94,7 @@ async def test_set_dnd_timer_success( # Verify the RPC call was made correctly with dataclass converted to dict expected_params = [22, 0, 8, 0] - mock_rpc_channel.send_command.mock_calls = [ + assert mock_rpc_channel.send_command.mock_calls == [ call(RoborockCommand.SET_DND_TIMER, params=expected_params), call(RoborockCommand.GET_DND_TIMER), ] @@ -127,7 +127,7 @@ async def test_clear_dnd_timer_success(dnd_trait: DoNotDisturbTrait, mock_rpc_ch await dnd_trait.clear_dnd_timer() # Verify the RPC call was made correctly - mock_rpc_channel.send_command.mock_calls = [ + assert mock_rpc_channel.send_command.mock_calls == [ call(RoborockCommand.CLOSE_DND_TIMER), call(RoborockCommand.GET_DND_TIMER), ] From 5c48f613c87cfbddbb68b89797a7b6a7d64374e5 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 15 Nov 2025 10:06:39 -0800 Subject: [PATCH 5/7] chore: Add comments everywhere on implicit refreshes --- roborock/devices/traits/v1/child_lock.py | 2 ++ roborock/devices/traits/v1/do_not_disturb.py | 2 ++ roborock/devices/traits/v1/flow_led_status.py | 2 ++ roborock/devices/traits/v1/led_status.py | 2 ++ roborock/devices/traits/v1/valley_electricity_timer.py | 3 +++ 5 files changed, 11 insertions(+) diff --git a/roborock/devices/traits/v1/child_lock.py b/roborock/devices/traits/v1/child_lock.py index 192e2a298..b801c566e 100644 --- a/roborock/devices/traits/v1/child_lock.py +++ b/roborock/devices/traits/v1/child_lock.py @@ -19,9 +19,11 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the child lock.""" await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 1}) + # Optimistcally update state to avoid an extra refresh self.lock_status = 1 async def disable(self) -> None: """Disable the child lock.""" await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 0}) + # Optimistcally update state to avoid an extra refresh self.lock_status = 0 diff --git a/roborock/devices/traits/v1/do_not_disturb.py b/roborock/devices/traits/v1/do_not_disturb.py index b96e600b9..dd33f59d4 100644 --- a/roborock/devices/traits/v1/do_not_disturb.py +++ b/roborock/devices/traits/v1/do_not_disturb.py @@ -31,9 +31,11 @@ async def enable(self) -> None: RoborockCommand.SET_DND_TIMER, params=self.as_list(), ) + # Optimistcally update state to avoid an extra refresh self.enabled = 1 async def disable(self) -> None: """Disable the Do Not Disturb (DND) timer settings of the device.""" await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) + # Optimistcally update state to avoid an extra refresh self.enabled = 0 diff --git a/roborock/devices/traits/v1/flow_led_status.py b/roborock/devices/traits/v1/flow_led_status.py index 0e95c0085..41e53d542 100644 --- a/roborock/devices/traits/v1/flow_led_status.py +++ b/roborock/devices/traits/v1/flow_led_status.py @@ -19,9 +19,11 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the Flow LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 1}) + # Optimistcally update state to avoid an extra refresh self.status = 1 async def disable(self) -> None: """Disable the Flow LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 0}) + # Optimistcally update state to avoid an extra refresh self.status = 0 diff --git a/roborock/devices/traits/v1/led_status.py b/roborock/devices/traits/v1/led_status.py index 5009964be..8988a7ef6 100644 --- a/roborock/devices/traits/v1/led_status.py +++ b/roborock/devices/traits/v1/led_status.py @@ -19,11 +19,13 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_LED_STATUS, params=[1]) + # Optimistcally update state to avoid an extra refresh self.status = 1 async def disable(self) -> None: """Disable the LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_LED_STATUS, params=[0]) + # Optimistcally update state to avoid an extra refresh self.status = 0 @classmethod diff --git a/roborock/devices/traits/v1/valley_electricity_timer.py b/roborock/devices/traits/v1/valley_electricity_timer.py index 4758a6c8e..2410da43d 100644 --- a/roborock/devices/traits/v1/valley_electricity_timer.py +++ b/roborock/devices/traits/v1/valley_electricity_timer.py @@ -19,6 +19,7 @@ def is_on(self) -> bool: async def set_timer(self, timer: ValleyElectricityTimer) -> None: """Set the Valley Electricity Timer settings of the device.""" await self.rpc_channel.send_command(RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=timer.as_list()) + await self.refresh() async def clear_timer(self) -> None: """Clear the Valley Electricity Timer settings of the device.""" @@ -31,6 +32,7 @@ async def enable(self) -> None: RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=self.as_list(), ) + # Optimistcally update state to avoid an extra refresh self.enabled = 1 async def disable(self) -> None: @@ -38,4 +40,5 @@ async def disable(self) -> None: await self.rpc_channel.send_command( RoborockCommand.CLOSE_VALLEY_ELECTRICITY_TIMER, ) + # Optimistcally update state to avoid an extra refresh self.enabled = 0 From cc783d7e0ec67ba9b402f5b75a61f5f1f32ae02b Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 15 Nov 2025 10:07:03 -0800 Subject: [PATCH 6/7] chore: Update roborock/devices/traits/v1/common.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- roborock/devices/traits/v1/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roborock/devices/traits/v1/common.py b/roborock/devices/traits/v1/common.py index a38bcf49f..6decf0bce 100644 --- a/roborock/devices/traits/v1/common.py +++ b/roborock/devices/traits/v1/common.py @@ -31,7 +31,7 @@ class V1TraitMixin(ABC): from the device. A trait can also support additional commands for updating state associated - with the trait. It is expected that a trait will update it's own internal + with the trait. It is expected that a trait will update its own internal state either reflecting the change optimistically or by refreshing the trait state from the device. In cases where one trait caches data that is also represented in another trait, it is the responsibility of the caller From da0336e9102ddcbca503b671b5a2c729f8f46e81 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 15 Nov 2025 15:06:39 -0800 Subject: [PATCH 7/7] chore: fix typos --- roborock/devices/traits/v1/child_lock.py | 4 ++-- roborock/devices/traits/v1/do_not_disturb.py | 4 ++-- roborock/devices/traits/v1/flow_led_status.py | 4 ++-- roborock/devices/traits/v1/led_status.py | 4 ++-- roborock/devices/traits/v1/valley_electricity_timer.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/roborock/devices/traits/v1/child_lock.py b/roborock/devices/traits/v1/child_lock.py index b801c566e..113066088 100644 --- a/roborock/devices/traits/v1/child_lock.py +++ b/roborock/devices/traits/v1/child_lock.py @@ -19,11 +19,11 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the child lock.""" await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 1}) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.lock_status = 1 async def disable(self) -> None: """Disable the child lock.""" await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 0}) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.lock_status = 0 diff --git a/roborock/devices/traits/v1/do_not_disturb.py b/roborock/devices/traits/v1/do_not_disturb.py index dd33f59d4..43de8ea5f 100644 --- a/roborock/devices/traits/v1/do_not_disturb.py +++ b/roborock/devices/traits/v1/do_not_disturb.py @@ -31,11 +31,11 @@ async def enable(self) -> None: RoborockCommand.SET_DND_TIMER, params=self.as_list(), ) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.enabled = 1 async def disable(self) -> None: """Disable the Do Not Disturb (DND) timer settings of the device.""" await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.enabled = 0 diff --git a/roborock/devices/traits/v1/flow_led_status.py b/roborock/devices/traits/v1/flow_led_status.py index 41e53d542..5a406000a 100644 --- a/roborock/devices/traits/v1/flow_led_status.py +++ b/roborock/devices/traits/v1/flow_led_status.py @@ -19,11 +19,11 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the Flow LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 1}) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.status = 1 async def disable(self) -> None: """Disable the Flow LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 0}) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.status = 0 diff --git a/roborock/devices/traits/v1/led_status.py b/roborock/devices/traits/v1/led_status.py index 8988a7ef6..41d15d539 100644 --- a/roborock/devices/traits/v1/led_status.py +++ b/roborock/devices/traits/v1/led_status.py @@ -19,13 +19,13 @@ def is_on(self) -> bool: async def enable(self) -> None: """Enable the LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_LED_STATUS, params=[1]) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.status = 1 async def disable(self) -> None: """Disable the LED status.""" await self.rpc_channel.send_command(RoborockCommand.SET_LED_STATUS, params=[0]) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.status = 0 @classmethod diff --git a/roborock/devices/traits/v1/valley_electricity_timer.py b/roborock/devices/traits/v1/valley_electricity_timer.py index 2410da43d..d21a229d1 100644 --- a/roborock/devices/traits/v1/valley_electricity_timer.py +++ b/roborock/devices/traits/v1/valley_electricity_timer.py @@ -32,7 +32,7 @@ async def enable(self) -> None: RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=self.as_list(), ) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.enabled = 1 async def disable(self) -> None: @@ -40,5 +40,5 @@ async def disable(self) -> None: await self.rpc_channel.send_command( RoborockCommand.CLOSE_VALLEY_ELECTRICITY_TIMER, ) - # Optimistcally update state to avoid an extra refresh + # Optimistic update to avoid an extra refresh self.enabled = 0