Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to adapt the official forward and reverse direction #116

Closed
countrysideboy opened this issue May 7, 2021 · 0 comments
Closed

try to adapt the official forward and reverse direction #116

countrysideboy opened this issue May 7, 2021 · 0 comments

Comments

@countrysideboy
Copy link

async def async_set_direction(self, direction: str) -> None:
    """Set the direction of the fan."""
    if direction in ["left", "right", "forward", "reverse"]:
        if self._oscillate:
            await self._try_command(
                "Setting oscillate off of the miio device failed.",
                self._device.set_oscillate,
                False,
            )

        if direction == "forward":
            await self._try_command(
                "Setting move direction of the miio device failed.",
                self._device.set_rotate,
                FanMoveDirection("right"),
            )
        elif direction == "reverse":
            await self._try_command(
                "Setting move direction of the miio device failed.",
                self._device.set_rotate,
                FanMoveDirection("left"),
            )
        else:
            await self._try_command(
                "Setting move direction of the miio device failed.",
                self._device.set_rotate,
                FanMoveDirection(direction),
            )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant