Return alias as None for new discovery devices before update (#627)

* Trim the length of the unavailable device alias

* Update to use short mac as auth required alias

* Update to return alias as none
This commit is contained in:
Steven B
2024-01-11 15:12:02 +00:00
committed by GitHub
parent fd2170c82c
commit 5b8280a8d9
5 changed files with 11 additions and 13 deletions

View File

@@ -1,6 +1,5 @@
"""Discovery module for TP-Link Smart Home devices."""
import asyncio
import base64
import binascii
import ipaddress
import logging
@@ -35,9 +34,6 @@ _LOGGER = logging.getLogger(__name__)
OnDiscoveredCallable = Callable[[SmartDevice], Awaitable[None]]
DeviceDict = Dict[str, SmartDevice]
UNAVAILABLE_ALIAS = "Authentication required"
UNAVAILABLE_NICKNAME = base64.b64encode(UNAVAILABLE_ALIAS.encode()).decode()
class _DiscoverProtocol(asyncio.DatagramProtocol):
"""Implementation of the discovery protocol handler.
@@ -463,9 +459,7 @@ class Discover:
device = device_class(config.host, protocol=protocol)
di = discovery_result.get_dict()
di["model"] = discovery_result.device_model
di["alias"] = UNAVAILABLE_ALIAS
di["nickname"] = UNAVAILABLE_NICKNAME
di["model"], _, _ = discovery_result.device_model.partition("(")
device.update_from_discover_info(di)
return device