Use _get_device_info methods for smart and iot devs in devtools (#1265)

This commit is contained in:
Steven B.
2024-11-18 14:53:11 +00:00
committed by GitHub
parent 9d46996e9b
commit e209d40a6d
20 changed files with 386 additions and 168 deletions

View File

@@ -19,9 +19,9 @@ from kasa import (
)
from kasa.device_factory import (
Device,
IotDevice,
SmartCamera,
SmartDevice,
_get_device_type_from_sys_info,
connect,
get_device_class_from_family,
get_protocol,
@@ -182,12 +182,12 @@ async def test_device_types(dev: Device):
res = SmartCamera._get_device_type_from_sysinfo(dev.sys_info)
elif isinstance(dev, SmartDevice):
assert dev._discovery_info
device_type = cast(str, dev._discovery_info["result"]["device_type"])
device_type = cast(str, dev._discovery_info["device_type"])
res = SmartDevice._get_device_type_from_components(
list(dev._components.keys()), device_type
)
else:
res = _get_device_type_from_sys_info(dev._last_update)
res = IotDevice._get_device_type_from_sys_info(dev._last_update)
assert dev.device_type == res