File tree Expand file tree Collapse file tree 5 files changed +11
-0
lines changed
roborock/devices/traits/v1 Expand file tree Collapse file tree 5 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,11 @@ def is_on(self) -> bool:
1919 async def enable (self ) -> None :
2020 """Enable the child lock."""
2121 await self .rpc_channel .send_command (RoborockCommand .SET_CHILD_LOCK_STATUS , params = {_STATUS_PARAM : 1 })
22+ # Optimistcally update state to avoid an extra refresh
2223 self .lock_status = 1
2324
2425 async def disable (self ) -> None :
2526 """Disable the child lock."""
2627 await self .rpc_channel .send_command (RoborockCommand .SET_CHILD_LOCK_STATUS , params = {_STATUS_PARAM : 0 })
28+ # Optimistcally update state to avoid an extra refresh
2729 self .lock_status = 0
Original file line number Diff line number Diff line change @@ -31,9 +31,11 @@ async def enable(self) -> None:
3131 RoborockCommand .SET_DND_TIMER ,
3232 params = self .as_list (),
3333 )
34+ # Optimistcally update state to avoid an extra refresh
3435 self .enabled = 1
3536
3637 async def disable (self ) -> None :
3738 """Disable the Do Not Disturb (DND) timer settings of the device."""
3839 await self .rpc_channel .send_command (RoborockCommand .CLOSE_DND_TIMER )
40+ # Optimistcally update state to avoid an extra refresh
3941 self .enabled = 0
Original file line number Diff line number Diff line change @@ -19,9 +19,11 @@ def is_on(self) -> bool:
1919 async def enable (self ) -> None :
2020 """Enable the Flow LED status."""
2121 await self .rpc_channel .send_command (RoborockCommand .SET_FLOW_LED_STATUS , params = {_STATUS_PARAM : 1 })
22+ # Optimistcally update state to avoid an extra refresh
2223 self .status = 1
2324
2425 async def disable (self ) -> None :
2526 """Disable the Flow LED status."""
2627 await self .rpc_channel .send_command (RoborockCommand .SET_FLOW_LED_STATUS , params = {_STATUS_PARAM : 0 })
28+ # Optimistcally update state to avoid an extra refresh
2729 self .status = 0
Original file line number Diff line number Diff line change @@ -19,11 +19,13 @@ def is_on(self) -> bool:
1919 async def enable (self ) -> None :
2020 """Enable the LED status."""
2121 await self .rpc_channel .send_command (RoborockCommand .SET_LED_STATUS , params = [1 ])
22+ # Optimistcally update state to avoid an extra refresh
2223 self .status = 1
2324
2425 async def disable (self ) -> None :
2526 """Disable the LED status."""
2627 await self .rpc_channel .send_command (RoborockCommand .SET_LED_STATUS , params = [0 ])
28+ # Optimistcally update state to avoid an extra refresh
2729 self .status = 0
2830
2931 @classmethod
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ def is_on(self) -> bool:
1919 async def set_timer (self , timer : ValleyElectricityTimer ) -> None :
2020 """Set the Valley Electricity Timer settings of the device."""
2121 await self .rpc_channel .send_command (RoborockCommand .SET_VALLEY_ELECTRICITY_TIMER , params = timer .as_list ())
22+ await self .refresh ()
2223
2324 async def clear_timer (self ) -> None :
2425 """Clear the Valley Electricity Timer settings of the device."""
@@ -31,11 +32,13 @@ async def enable(self) -> None:
3132 RoborockCommand .SET_VALLEY_ELECTRICITY_TIMER ,
3233 params = self .as_list (),
3334 )
35+ # Optimistcally update state to avoid an extra refresh
3436 self .enabled = 1
3537
3638 async def disable (self ) -> None :
3739 """Disable the Valley Electricity Timer settings of the device."""
3840 await self .rpc_channel .send_command (
3941 RoborockCommand .CLOSE_VALLEY_ELECTRICITY_TIMER ,
4042 )
43+ # Optimistcally update state to avoid an extra refresh
4144 self .enabled = 0
You can’t perform that action at this time.
0 commit comments