diff --git a/miio/miioprotocol.py b/miio/miioprotocol.py index b0f5cbb08..dee26d531 100644 --- a/miio/miioprotocol.py +++ b/miio/miioprotocol.py @@ -102,7 +102,8 @@ def discover(addr: str = None) -> Any: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.settimeout(timeout) - s.sendto(helobytes, (addr, 54321)) + for _ in range(3): + s.sendto(helobytes, (addr, 54321)) while True: try: data, addr = s.recvfrom(1024) @@ -141,7 +142,7 @@ def send( :param str command: Command to send :param dict parameters: Parameters to send, or an empty list - :param retry_count: How many times to retry in case of failure + :param retry_count: How many times to retry in case of failure, how many handshakes to send :param dict extra_parameters: Extra top-level parameters :raises DeviceException: if an error has occurred during communication."""