mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2025-02-18 02:02:13 +01:00
Fix BLE writes timing out (#298)
This commit is contained in:
parent
088cbe9fc3
commit
dbfff4397e
@ -531,7 +531,7 @@ class APIClient:
|
|||||||
# to avoid race were we run out even though we have a slot.
|
# to avoid race were we run out even though we have a slot.
|
||||||
await self.bluetooth_device_disconnect(address)
|
await self.bluetooth_device_disconnect(address)
|
||||||
raise TimeoutAPIError(
|
raise TimeoutAPIError(
|
||||||
f"Timeout waiting for connect response while connecting to {to_human_readable_address(address)}"
|
f"Timeout waiting for connect response while connecting to {to_human_readable_address(address)} after {timeout}s"
|
||||||
) from err
|
) from err
|
||||||
|
|
||||||
return unsub
|
return unsub
|
||||||
@ -613,7 +613,7 @@ class APIClient:
|
|||||||
handle: int,
|
handle: int,
|
||||||
data: bytes,
|
data: bytes,
|
||||||
response: bool,
|
response: bool,
|
||||||
timeout: float = 10.0,
|
timeout: float = DEFAULT_BLE_TIMEOUT,
|
||||||
) -> None:
|
) -> None:
|
||||||
req = BluetoothGATTWriteRequest()
|
req = BluetoothGATTWriteRequest()
|
||||||
req.address = address
|
req.address = address
|
||||||
@ -656,7 +656,7 @@ class APIClient:
|
|||||||
address: int,
|
address: int,
|
||||||
handle: int,
|
handle: int,
|
||||||
data: bytes,
|
data: bytes,
|
||||||
timeout: float = 10.0,
|
timeout: float = DEFAULT_BLE_TIMEOUT,
|
||||||
) -> None:
|
) -> None:
|
||||||
req = BluetoothGATTWriteDescriptorRequest()
|
req = BluetoothGATTWriteDescriptorRequest()
|
||||||
req.address = address
|
req.address = address
|
||||||
|
@ -469,7 +469,7 @@ class APIConnection:
|
|||||||
await fut
|
await fut
|
||||||
except asyncio.TimeoutError as err:
|
except asyncio.TimeoutError as err:
|
||||||
raise TimeoutAPIError(
|
raise TimeoutAPIError(
|
||||||
f"Timeout waiting for response for {type(send_msg)}"
|
f"Timeout waiting for response for {type(send_msg)} after {timeout}s"
|
||||||
) from err
|
) from err
|
||||||
finally:
|
finally:
|
||||||
with suppress(ValueError):
|
with suppress(ValueError):
|
||||||
|
Loading…
Reference in New Issue
Block a user