Example #1
0
    async def async_set_direction(self, direction: str) -> None:
        """Set the direction of the fan."""
        if self._oscillating:
            await self.async_oscillate(oscillating=False)

        await self._try_command(
            "Setting move direction of the miio device failed.",
            self._device.set_rotate,
            FanMoveDirection(FAN_DIRECTIONS_MAP[direction]),
        )
Example #2
0
    async def async_set_direction(self, direction: str) -> None:
        """Set the direction of the fan."""
        if direction in ["left", "right"]:
            if self._oscillate:
                await self._try_command(
                    "Setting oscillate off of the miio device failed.",
                    self._device.set_oscillate,
                    False,
                )

            await self._try_command(
                "Setting move direction of the miio device failed.",
                self._device.set_rotate,
                FanMoveDirection(direction),
            )
Example #3
0
    async def async_set_direction(self, direction: str) -> None:
        """Set the direction of the fan."""
        if direction == 'forward':
            direction = 'right'

        if direction == 'reverse':
            direction = 'left'

        if self._oscillate:
            await self._try_command(
                "Setting oscillate off of the miio device failed.",
                self._device.set_oscillate,
                False,
            )

        await self._try_command(
            "Setting move direction of the miio device failed.",
            self._device.set_rotate,
            FanMoveDirection(direction),
        )