Skip to content

Commit

Permalink
Add update_service callback for zeroconf listener (#1112)
Browse files Browse the repository at this point in the history
This callback does not currently do anything, just avoids a warning
about it being missing on recent python-zeroconf versions.

Fixes #1101
  • Loading branch information
rytilahti authored Aug 12, 2021
1 parent a11b944 commit 7a3c0d4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions miio/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7a3c0d4

Please sign in to comment.