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 converter = common.DefaultConverter(DnDTimer) 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
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 converter = common.DefaultConverter(DnDTimer) 14 15 @property 16 def is_on(self) -> bool: 17 """Return whether the Do Not Disturb (DND) timer is enabled.""" 18 return self.enabled == 1 19 20 async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None: 21 """Set the Do Not Disturb (DND) timer settings of the device.""" 22 await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list()) 23 await self.refresh() 24 25 async def clear_dnd_timer(self) -> None: 26 """Clear the Do Not Disturb (DND) timer settings of the device.""" 27 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 28 await self.refresh() 29 30 async def enable(self) -> None: 31 """Set the Do Not Disturb (DND) timer settings of the device.""" 32 await self.rpc_channel.send_command( 33 RoborockCommand.SET_DND_TIMER, 34 params=self.as_list(), 35 ) 36 # Optimistic update to avoid an extra refresh 37 self.enabled = 1 38 39 async def disable(self) -> None: 40 """Disable the Do Not Disturb (DND) timer settings of the device.""" 41 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 42 # Optimistic update to avoid an extra refresh 43 self.enabled = 0
Trait for managing Do Not Disturb (DND) settings on Roborock devices.
command =
<RoborockCommand.GET_DND_TIMER: 'get_dnd_timer'>
The RoborockCommand used to fetch the trait data from the device (internal only).
converter =
DefaultConverter
The converter used to parse the response from the device (internal only).
is_on: bool
15 @property 16 def is_on(self) -> bool: 17 """Return whether the Do Not Disturb (DND) timer is enabled.""" 18 return self.enabled == 1
Return whether the Do Not Disturb (DND) timer is enabled.
20 async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None: 21 """Set the Do Not Disturb (DND) timer settings of the device.""" 22 await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list()) 23 await self.refresh()
Set the Do Not Disturb (DND) timer settings of the device.
async def
clear_dnd_timer(self) -> None:
25 async def clear_dnd_timer(self) -> None: 26 """Clear the Do Not Disturb (DND) timer settings of the device.""" 27 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 28 await self.refresh()
Clear the Do Not Disturb (DND) timer settings of the device.
async def
enable(self) -> None:
30 async def enable(self) -> None: 31 """Set the Do Not Disturb (DND) timer settings of the device.""" 32 await self.rpc_channel.send_command( 33 RoborockCommand.SET_DND_TIMER, 34 params=self.as_list(), 35 ) 36 # Optimistic update to avoid an extra refresh 37 self.enabled = 1
Set the Do Not Disturb (DND) timer settings of the device.
async def
disable(self) -> None:
39 async def disable(self) -> None: 40 """Disable the Do Not Disturb (DND) timer settings of the device.""" 41 await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) 42 # Optimistic update to avoid an extra refresh 43 self.enabled = 0
Disable the Do Not Disturb (DND) timer settings of the device.