Raise TimeoutException on discover_single timeout (#632)

This commit is contained in:
Steven B 2024-01-11 15:13:44 +00:00 committed by GitHub
parent 5b8280a8d9
commit fbce755544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -25,6 +25,7 @@ from kasa.emeterstatus import EmeterStatus
from kasa.exceptions import (
AuthenticationException,
SmartDeviceException,
TimeoutException,
UnsupportedDeviceException,
)
from kasa.iotprotocol import IotProtocol
@ -60,6 +61,7 @@ __all__ = [
"SmartLightStrip",
"AuthenticationException",
"UnsupportedDeviceException",
"TimeoutException",
"Credentials",
"DeviceConfig",
"ConnectionType",

View File

@ -22,7 +22,7 @@ from kasa.device_factory import (
get_protocol,
)
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 loads as json_loads
from kasa.protocol import TPLinkSmartHomeProtocol
@ -347,7 +347,7 @@ class Discover:
async with asyncio_timeout(discovery_timeout):
await event.wait()
except asyncio.TimeoutError as ex:
raise SmartDeviceException(
raise TimeoutException(
f"Timed out getting discovery response for {host}"
) from ex
finally: