From d1744fddd728861e49c5b5f77a7c2b727088383d Mon Sep 17 00:00:00 2001 From: Guido Schmitz Date: Wed, 2 Dec 2020 11:57:41 +0100 Subject: [PATCH] Cosmetic changes --- devolo_plc_api/device.py | 4 ++-- devolo_plc_api/network/__init__.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/devolo_plc_api/device.py b/devolo_plc_api/device.py index 127084e..2915020 100644 --- a/devolo_plc_api/device.py +++ b/devolo_plc_api/device.py @@ -165,10 +165,10 @@ def _state_change(self, zeroconf: Zeroconf, service_type: str, name: str, state_ @staticmethod def info_from_service(service_info: ServiceInfo) -> Optional[Dict]: - """Return prepared info from mDNS entries.""" + """ Return prepared info from mDNS entries. """ properties = {} if not service_info.addresses: - return # No need to continue, if there is no IP address to contact the device + return None # No need to continue, if there is no IP address to contact the device total_length = len(service_info.text) offset = 0 diff --git a/devolo_plc_api/network/__init__.py b/devolo_plc_api/network/__init__.py index c278dc7..c58f3c2 100644 --- a/devolo_plc_api/network/__init__.py +++ b/devolo_plc_api/network/__init__.py @@ -11,6 +11,11 @@ async def async_discover_network() -> Dict[str, Device]: + """ + Discover all devices that expose the devolo device API via mDNS asynchronous. + + :return: Devices accessible via serial number. + """ browser = ServiceBrowser(Zeroconf(), "_dvl-deviceapi._tcp.local.", [_add]) await asyncio.sleep(3) browser.cancel() @@ -19,6 +24,11 @@ async def async_discover_network() -> Dict[str, Device]: def discover_network() -> Dict[str, Device]: + """ + Discover devices that expose the devolo device API via mDNS synchronous. + + :return: Devices accessible via serial number. + """ browser = ServiceBrowser(Zeroconf(), "_dvl-deviceapi._tcp.local.", [_add]) time.sleep(3) browser.cancel()