roborock.devices.traits.v1.do_not_disturb
1from roborock.data import DnDTimer 2from roborock.devices.traits.v1 import common 3from roborock.roborock_typing import RoborockCommand 4 5_ENABLED_PARAM = "enabled" 6 7 8class DoNotDisturbTrait(DnDTimer, common.V1TraitMixin, common.RoborockSwitchBase): 9 """Trait for managing Do Not Disturb (DND) settings on Roborock devices.""" 10 11 command = RoborockCommand.GET_DND_TIMER 12 13 @property 14 def is_on(self) -> bool: 15 """Return whether the Do Not Disturb (DND) timer is enabled.""" 16 return self.enabled == 1 17 18 async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None: 19 """Set the Do Not Disturb (DND) timer settings of the device.""" 20 await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list()) 21 await self.refresh() 22 23 async def clear_dnd_timer(self) -> None: 24 """Clear the Do Not Disturb (DND) timer settings of the device.""" 25 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 26 await self.refresh() 27 28 async def enable(self) -> None: 29 """Set the Do Not Disturb (DND) timer settings of the device.""" 30 await self.rpc_channel.send_command( 31 RoborockCommand.SET_DND_TIMER, 32 params=self.as_list(), 33 ) 34 # Optimistic update to avoid an extra refresh 35 self.enabled = 1 36 37 async def disable(self) -> None: 38 """Disable the Do Not Disturb (DND) timer settings of the device.""" 39 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 40 # Optimistic update to avoid an extra refresh 41 self.enabled = 0
class
DoNotDisturbTrait(roborock.data.v1.v1_containers.DnDTimer, roborock.devices.traits.v1.common.V1TraitMixin, roborock.devices.traits.v1.common.RoborockSwitchBase):
9class DoNotDisturbTrait(DnDTimer, common.V1TraitMixin, common.RoborockSwitchBase): 10 """Trait for managing Do Not Disturb (DND) settings on Roborock devices.""" 11 12 command = RoborockCommand.GET_DND_TIMER 13 14 @property 15 def is_on(self) -> bool: 16 """Return whether the Do Not Disturb (DND) timer is enabled.""" 17 return self.enabled == 1 18 19 async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None: 20 """Set the Do Not Disturb (DND) timer settings of the device.""" 21 await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list()) 22 await self.refresh() 23 24 async def clear_dnd_timer(self) -> None: 25 """Clear the Do Not Disturb (DND) timer settings of the device.""" 26 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 27 await self.refresh() 28 29 async def enable(self) -> None: 30 """Set the Do Not Disturb (DND) timer settings of the device.""" 31 await self.rpc_channel.send_command( 32 RoborockCommand.SET_DND_TIMER, 33 params=self.as_list(), 34 ) 35 # Optimistic update to avoid an extra refresh 36 self.enabled = 1 37 38 async def disable(self) -> None: 39 """Disable the Do Not Disturb (DND) timer settings of the device.""" 40 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 41 # Optimistic update to avoid an extra refresh 42 self.enabled = 0
Trait for managing Do Not Disturb (DND) settings on Roborock devices.
is_on: bool
14 @property 15 def is_on(self) -> bool: 16 """Return whether the Do Not Disturb (DND) timer is enabled.""" 17 return self.enabled == 1
Return whether the Do Not Disturb (DND) timer is enabled.
19 async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None: 20 """Set the Do Not Disturb (DND) timer settings of the device.""" 21 await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list()) 22 await self.refresh()
Set the Do Not Disturb (DND) timer settings of the device.
async def
clear_dnd_timer(self) -> None:
24 async def clear_dnd_timer(self) -> None: 25 """Clear the Do Not Disturb (DND) timer settings of the device.""" 26 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 27 await self.refresh()
Clear the Do Not Disturb (DND) timer settings of the device.
async def
enable(self) -> None:
29 async def enable(self) -> None: 30 """Set the Do Not Disturb (DND) timer settings of the device.""" 31 await self.rpc_channel.send_command( 32 RoborockCommand.SET_DND_TIMER, 33 params=self.as_list(), 34 ) 35 # Optimistic update to avoid an extra refresh 36 self.enabled = 1
Set the Do Not Disturb (DND) timer settings of the device.
async def
disable(self) -> None:
38 async def disable(self) -> None: 39 """Disable the Do Not Disturb (DND) timer settings of the device.""" 40 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 41 # Optimistic update to avoid an extra refresh 42 self.enabled = 0
Disable the Do Not Disturb (DND) timer settings of the device.