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    requires_feature = "is_flow_led_setting_supported"
13
14    @property
15    def is_on(self) -> bool:
16        """Return whether the Flow LED status is enabled."""
17        return self.status == 1
18
19    async def enable(self) -> None:
20        """Enable the Flow LED status."""
21        await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 1})
22        # Optimistic update to avoid an extra refresh
23        self.status = 1
24
25    async def disable(self) -> None:
26        """Disable the Flow LED status."""
27        await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 0})
28        # Optimistic update to avoid an extra refresh
29        self.status = 0
 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    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

Trait for controlling the Flow LED status of a Roborock device.

command = <RoborockCommand.GET_FLOW_LED_STATUS: 'get_flow_led_status'>
requires_feature = 'is_flow_led_setting_supported'
is_on: bool
15    @property
16    def is_on(self) -> bool:
17        """Return whether the Flow LED status is enabled."""
18        return self.status == 1

Return whether the Flow LED status is enabled.

async def enable(self) -> None:
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

Enable the Flow LED status.

async def disable(self) -> None:
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

Disable the Flow LED status.