mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-09 22:37:08 +00:00
adjust per review
This commit is contained in:
parent
6573ee0f8a
commit
bcdcd5f982
@ -341,12 +341,19 @@ class Discover:
|
||||
|
||||
:param host: Hostname of device to query
|
||||
:param device_type: Device type to use for the device.
|
||||
If not given, the device type is discovered by querying the device.
|
||||
If the device type is already known, it is preferred to pass it
|
||||
to avoid the extra query to the device to discover its type.
|
||||
:rtype: SmartDevice
|
||||
:return: Object for querying/controlling found device.
|
||||
"""
|
||||
if device_type and (klass := DEVICE_TYPE_TO_CLASS.get(device_type)):
|
||||
dev = klass(host=host, port=port, credentials=credentials, timeout=timeout)
|
||||
else:
|
||||
dev: SmartDevice = klass(
|
||||
host=host, port=port, credentials=credentials, timeout=timeout
|
||||
)
|
||||
await dev.update()
|
||||
return dev
|
||||
|
||||
unknown_dev = SmartDevice(
|
||||
host=host, port=port, credentials=credentials, timeout=timeout
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user