diff --git a/broadlink/device.py b/broadlink/device.py index d21c59a..e675377 100644 --- a/broadlink/device.py +++ b/broadlink/device.py @@ -262,7 +262,7 @@ class device: """Return device type.""" return self.type - def send_packet(self, command: int, payload: bytes, retry_intvl: float = 1.0) -> bytes: + def send_packet(self, command: int, payload: bytes) -> bytes: """Send a packet to the device.""" self.count = ((self.count + 1) | 0x8000) & 0xFFFF packet = bytearray(0x38) @@ -315,7 +315,7 @@ class device: while True: time_left = timeout - (time.time() - start_time) - conn.settimeout(min(retry_intvl, time_left)) + conn.settimeout(min(1, time_left)) conn.sendto(packet, self.host) try: diff --git a/broadlink/remote.py b/broadlink/remote.py index 453610f..03b59eb 100644 --- a/broadlink/remote.py +++ b/broadlink/remote.py @@ -13,10 +13,10 @@ class rm(device): device.__init__(self, *args, **kwargs) self.type = "RM2" - def _send(self, command: int, data: bytes = b'', retry_intvl: float = 1.0) -> bytes: + def _send(self, command: int, data: bytes = b'') -> bytes: """Send a packet to the device.""" packet = struct.pack(" None: """Send a code to the device.""" - self._send(0x2, data=data, retry_intvl=5) + self._send(0x2, data) def enter_learning(self) -> None: """Enter infrared learning mode.""" @@ -71,10 +71,10 @@ class rm4(rm): device.__init__(self, *args, **kwargs) self.type = "RM4" - def _send(self, command: int, data: bytes = b'', retry_intvl: float = 1.0) -> bytes: + def _send(self, command: int, data: bytes = b'') -> bytes: """Send a packet to the device.""" packet = struct.pack("