roborock.devices.traits.v1.flow_led_status
1from roborock.data import FlowLedStatus 2from roborock.devices.traits.v1 import common 3from roborock.roborock_typing import RoborockCommand 4 5_STATUS_PARAM = "status" 6 7 8class FlowLedStatusTrait(FlowLedStatus, common.V1TraitMixin, common.RoborockSwitchBase): 9 """Trait for controlling the Flow LED status of a Roborock device.""" 10 11 command = RoborockCommand.GET_FLOW_LED_STATUS 12 converter = common.DefaultConverter(FlowLedStatus) 13 requires_feature = "is_flow_led_setting_supported" 14 15 @property 16 def is_on(self) -> bool: 17 """Return whether the Flow LED status is enabled.""" 18 return self.status == 1 19 20 async def enable(self) -> None: 21 """Enable the Flow LED status.""" 22 await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 1}) 23 # Optimistic update to avoid an extra refresh 24 self.status = 1 25 26 async def disable(self) -> None: 27 """Disable the Flow LED status.""" 28 await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 0}) 29 # Optimistic update to avoid an extra refresh 30 self.status = 0
class
FlowLedStatusTrait(roborock.data.v1.v1_containers.FlowLedStatus, roborock.devices.traits.v1.common.V1TraitMixin, roborock.devices.traits.v1.common.RoborockSwitchBase):
9class FlowLedStatusTrait(FlowLedStatus, common.V1TraitMixin, common.RoborockSwitchBase): 10 """Trait for controlling the Flow LED status of a Roborock device.""" 11 12 command = RoborockCommand.GET_FLOW_LED_STATUS 13 converter = common.DefaultConverter(FlowLedStatus) 14 requires_feature = "is_flow_led_setting_supported" 15 16 @property 17 def is_on(self) -> bool: 18 """Return whether the Flow LED status is enabled.""" 19 return self.status == 1 20 21 async def enable(self) -> None: 22 """Enable the Flow LED status.""" 23 await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 1}) 24 # Optimistic update to avoid an extra refresh 25 self.status = 1 26 27 async def disable(self) -> None: 28 """Disable the Flow LED status.""" 29 await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 0}) 30 # Optimistic update to avoid an extra refresh 31 self.status = 0
Trait for controlling the Flow LED status of a Roborock device.
command =
<RoborockCommand.GET_FLOW_LED_STATUS: 'get_flow_led_status'>
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
16 @property 17 def is_on(self) -> bool: 18 """Return whether the Flow LED status is enabled.""" 19 return self.status == 1
Return whether the Flow LED status is enabled.
async def
enable(self) -> None:
21 async def enable(self) -> None: 22 """Enable the Flow LED status.""" 23 await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 1}) 24 # Optimistic update to avoid an extra refresh 25 self.status = 1
Enable the Flow LED status.
async def
disable(self) -> None:
27 async def disable(self) -> None: 28 """Disable the Flow LED status.""" 29 await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 0}) 30 # Optimistic update to avoid an extra refresh 31 self.status = 0
Disable the Flow LED status.