From 15e6279246b1f011ac8e7283db0138d248a3b5fe Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 28 Nov 2023 08:07:33 -0600 Subject: [PATCH] Allow specifying a timeout for bluetooth_gatt_start_notify (#770) --- aioesphomeapi/client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/aioesphomeapi/client.py b/aioesphomeapi/client.py index f3f848d..19962fd 100644 --- a/aioesphomeapi/client.py +++ b/aioesphomeapi/client.py @@ -830,7 +830,7 @@ class APIClient: handle, req, BluetoothGATTWriteResponse, - timeout=timeout, + timeout, ) async def bluetooth_gatt_read_descriptor( @@ -862,7 +862,7 @@ class APIClient: handle, req, BluetoothGATTReadResponse, - timeout=timeout, + timeout, ) if TYPE_CHECKING: assert isinstance(resp, BluetoothGATTReadResponse) @@ -889,7 +889,7 @@ class APIClient: handle, req, BluetoothGATTWriteResponse, - timeout=timeout, + timeout, ) async def bluetooth_gatt_start_notify( @@ -897,6 +897,7 @@ class APIClient: address: int, handle: int, on_bluetooth_gatt_notify: Callable[[int, bytearray], None], + timeout: float = 10.0, ) -> tuple[Callable[[], Coroutine[Any, Any, None]], Callable[[], None]]: """Start a notify session for a GATT characteristic. @@ -924,6 +925,7 @@ class APIClient: handle, BluetoothGATTNotifyRequest(address=address, handle=handle, enable=True), BluetoothGATTNotifyResponse, + timeout, ) except Exception: remove_callback()