roborock.devices.traits.v1.child_lock
1from roborock.data import ChildLockStatus 2from roborock.devices.traits.v1 import common 3from roborock.roborock_typing import RoborockCommand 4 5_STATUS_PARAM = "lock_status" 6 7 8class ChildLockTrait(ChildLockStatus, common.V1TraitMixin, common.RoborockSwitchBase): 9 """Trait for controlling the child lock of a Roborock device.""" 10 11 command = RoborockCommand.GET_CHILD_LOCK_STATUS 12 requires_feature = "is_set_child_supported" 13 14 @property 15 def is_on(self) -> bool: 16 """Return whether the child lock is enabled.""" 17 return self.lock_status == 1 18 19 async def enable(self) -> None: 20 """Enable the child lock.""" 21 await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 1}) 22 # Optimistic update to avoid an extra refresh 23 self.lock_status = 1 24 25 async def disable(self) -> None: 26 """Disable the child lock.""" 27 await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 0}) 28 # Optimistic update to avoid an extra refresh 29 self.lock_status = 0
class
ChildLockTrait(roborock.data.v1.v1_containers.ChildLockStatus, roborock.devices.traits.v1.common.V1TraitMixin, roborock.devices.traits.v1.common.RoborockSwitchBase):
9class ChildLockTrait(ChildLockStatus, common.V1TraitMixin, common.RoborockSwitchBase): 10 """Trait for controlling the child lock of a Roborock device.""" 11 12 command = RoborockCommand.GET_CHILD_LOCK_STATUS 13 requires_feature = "is_set_child_supported" 14 15 @property 16 def is_on(self) -> bool: 17 """Return whether the child lock is enabled.""" 18 return self.lock_status == 1 19 20 async def enable(self) -> None: 21 """Enable the child lock.""" 22 await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 1}) 23 # Optimistic update to avoid an extra refresh 24 self.lock_status = 1 25 26 async def disable(self) -> None: 27 """Disable the child lock.""" 28 await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 0}) 29 # Optimistic update to avoid an extra refresh 30 self.lock_status = 0
Trait for controlling the child lock of a Roborock device.
is_on: bool
15 @property 16 def is_on(self) -> bool: 17 """Return whether the child lock is enabled.""" 18 return self.lock_status == 1
Return whether the child lock is enabled.
async def
enable(self) -> None:
20 async def enable(self) -> None: 21 """Enable the child lock.""" 22 await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 1}) 23 # Optimistic update to avoid an extra refresh 24 self.lock_status = 1
Enable the child lock.
async def
disable(self) -> None:
26 async def disable(self) -> None: 27 """Disable the child lock.""" 28 await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 0}) 29 # Optimistic update to avoid an extra refresh 30 self.lock_status = 0
Disable the child lock.