mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-09 06:17:08 +00:00
Raise TimeoutException on discover_single timeout (#632)
This commit is contained in:
parent
5b8280a8d9
commit
fbce755544
@ -25,6 +25,7 @@ from kasa.emeterstatus import EmeterStatus
|
|||||||
from kasa.exceptions import (
|
from kasa.exceptions import (
|
||||||
AuthenticationException,
|
AuthenticationException,
|
||||||
SmartDeviceException,
|
SmartDeviceException,
|
||||||
|
TimeoutException,
|
||||||
UnsupportedDeviceException,
|
UnsupportedDeviceException,
|
||||||
)
|
)
|
||||||
from kasa.iotprotocol import IotProtocol
|
from kasa.iotprotocol import IotProtocol
|
||||||
@ -60,6 +61,7 @@ __all__ = [
|
|||||||
"SmartLightStrip",
|
"SmartLightStrip",
|
||||||
"AuthenticationException",
|
"AuthenticationException",
|
||||||
"UnsupportedDeviceException",
|
"UnsupportedDeviceException",
|
||||||
|
"TimeoutException",
|
||||||
"Credentials",
|
"Credentials",
|
||||||
"DeviceConfig",
|
"DeviceConfig",
|
||||||
"ConnectionType",
|
"ConnectionType",
|
||||||
|
@ -22,7 +22,7 @@ from kasa.device_factory import (
|
|||||||
get_protocol,
|
get_protocol,
|
||||||
)
|
)
|
||||||
from kasa.deviceconfig import ConnectionType, DeviceConfig, EncryptType
|
from kasa.deviceconfig import ConnectionType, DeviceConfig, EncryptType
|
||||||
from kasa.exceptions import UnsupportedDeviceException
|
from kasa.exceptions import TimeoutException, UnsupportedDeviceException
|
||||||
from kasa.json import dumps as json_dumps
|
from kasa.json import dumps as json_dumps
|
||||||
from kasa.json import loads as json_loads
|
from kasa.json import loads as json_loads
|
||||||
from kasa.protocol import TPLinkSmartHomeProtocol
|
from kasa.protocol import TPLinkSmartHomeProtocol
|
||||||
@ -347,7 +347,7 @@ class Discover:
|
|||||||
async with asyncio_timeout(discovery_timeout):
|
async with asyncio_timeout(discovery_timeout):
|
||||||
await event.wait()
|
await event.wait()
|
||||||
except asyncio.TimeoutError as ex:
|
except asyncio.TimeoutError as ex:
|
||||||
raise SmartDeviceException(
|
raise TimeoutException(
|
||||||
f"Timed out getting discovery response for {host}"
|
f"Timed out getting discovery response for {host}"
|
||||||
) from ex
|
) from ex
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user