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

@@ -102,9 +102,12 @@ class TapoDevice(SmartDevice):
return str(self._info.get("model"))
@property
def alias(self) -> str:
def alias(self) -> Optional[str]:
"""Returns the device alias or nickname."""
return base64.b64decode(str(self._info.get("nickname"))).decode()
if self._info and (nickname := self._info.get("nickname")):
return base64.b64decode(nickname).decode()
else:
return None
@property
def time(self) -> datetime: