async def cover_command( self, key: int, position: Optional[float] = None, tilt: Optional[float] = None, stop: bool = False, ) -> None: self._check_authenticated() req = pb.CoverCommandRequest() req.key = key if self.api_version >= APIVersion(1, 1): if position is not None: req.has_position = True req.position = position if tilt is not None: req.has_tilt = True req.tilt = tilt if stop: req.stop = stop else: req.has_legacy_command = True if stop: req.legacy_command = LegacyCoverCommand.STOP elif position == 1.0: req.legacy_command = LegacyCoverCommand.OPEN else: req.legacy_command = LegacyCoverCommand.CLOSE await self._connection.send_message(req)
async def cover_command(self, key: int, command: int ) -> None: self._check_authenticated() req = pb.CoverCommandRequest() req.key = key req.has_state = True if command not in COVER_COMMANDS: raise ValueError req.command = command await self._connection.send_message(req)