mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-11 18:08:02 +00:00
Update try_connect_all to be more efficient and report attempts (#1222)
This commit is contained in:
@@ -167,7 +167,7 @@ def get_device_class_from_sys_info(sysinfo: dict[str, Any]) -> type[IotDevice]:
|
||||
|
||||
|
||||
def get_device_class_from_family(
|
||||
device_type: str, *, https: bool
|
||||
device_type: str, *, https: bool, require_exact: bool = False
|
||||
) -> type[Device] | None:
|
||||
"""Return the device class from the type name."""
|
||||
supported_device_types: dict[str, type[Device]] = {
|
||||
@@ -185,8 +185,10 @@ def get_device_class_from_family(
|
||||
}
|
||||
lookup_key = f"{device_type}{'.HTTPS' if https else ''}"
|
||||
if (
|
||||
cls := supported_device_types.get(lookup_key)
|
||||
) is None and device_type.startswith("SMART."):
|
||||
(cls := supported_device_types.get(lookup_key)) is None
|
||||
and device_type.startswith("SMART.")
|
||||
and not require_exact
|
||||
):
|
||||
_LOGGER.warning("Unknown SMART device with %s, using SmartDevice", device_type)
|
||||
cls = SmartDevice
|
||||
|
||||
|
Reference in New Issue
Block a user