Beispiel #1
0
    async def fan_command(self,
                          key: int,
                          state: Optional[bool] = None,
                          speed: Optional[FanSpeed] = None,
                          speed_level: Optional[int] = None,
                          oscillating: Optional[bool] = None,
                          direction: Optional[FanDirection] = None
                          ) -> None:
        self._check_authenticated()

        req = pb.FanCommandRequest()
        req.key = key
        if state is not None:
            req.has_state = True
            req.state = state
        if speed is not None:
            req.has_speed = True
            req.speed = speed
        if speed_level is not None:
            req.has_speed_level = True
            req.speed_level = speed_level
        if oscillating is not None:
            req.has_oscillating = True
            req.oscillating = oscillating
        if direction is not None:
            req.has_direction = True
            req.direction = direction
        await self._connection.send_message(req)
    async def fan_command(self,
                          key: int,
                          state: Optional[bool] = None,
                          speed: Optional[int] = None,
                          oscillating: Optional[bool] = None
                          ) -> None:
        self._check_authenticated()

        req = pb.FanCommandRequest()
        req.key = key
        if state is not None:
            req.has_state = True
            req.state = state
        if speed is not None:
            req.has_speed = True
            if speed not in FAN_SPEEDS:
                raise ValueError
            req.speed = speed
        if oscillating is not None:
            req.has_oscillating = True
            req.oscillating = oscillating
        await self._connection.send_message(req)