Fix repr for device created with no sysinfo or discovery info" (#1266)

Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
Steven B.
2024-11-18 13:14:39 +00:00
committed by GitHub
parent fd5258c28b
commit 9d46996e9b
7 changed files with 101 additions and 18 deletions

View File

@@ -25,8 +25,11 @@ class SmartCamera(SmartDevice):
@staticmethod
def _get_device_type_from_sysinfo(sysinfo: dict[str, Any]) -> DeviceType:
"""Find type to be displayed as a supported device category."""
device_type = sysinfo["device_type"]
if device_type.endswith("HUB"):
if (
sysinfo
and (device_type := sysinfo.get("device_type"))
and device_type.endswith("HUB")
):
return DeviceType.Hub
return DeviceType.Camera