diff --git a/miio/discovery.py b/miio/discovery.py index c7c673f44..83e755bc7 100644 --- a/miio/discovery.py +++ b/miio/discovery.py @@ -271,13 +271,18 @@ def check_and_create_device(self, info, addr) -> Optional[Device]: ) return None - def add_service(self, zeroconf, type, name): - info = zeroconf.get_service_info(type, name) + def add_service(self, zeroconf: "zeroconf.Zeroconf", type_: str, name: str) -> None: + """Callback for discovery responses.""" + info = zeroconf.get_service_info(type_, name) addr = get_addr_from_info(info) if addr not in self.found_devices: dev = self.check_and_create_device(info, addr) - self.found_devices[addr] = dev + if dev is not None: + self.found_devices[addr] = dev + + def update_service(self, zc: "zeroconf.Zeroconf", type_: str, name: str) -> None: + """Callback for state updates, which we ignore for now.""" class Discovery: