mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-26 17:27:40 +01:00
Adjust ble timeouts to be longer than bleak timeouts (#287)
This commit is contained in:
parent
021e2563a3
commit
745e0b688e
@ -153,6 +153,8 @@ from .model import (
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_BLE_TIMEOUT = 30.0
|
||||
|
||||
ExecuteServiceDataType = Dict[
|
||||
str, Union[bool, int, float, str, List[bool], List[int], List[float], List[str]]
|
||||
]
|
||||
@ -451,7 +453,7 @@ class APIClient:
|
||||
self,
|
||||
address: int,
|
||||
on_bluetooth_connection_state: Callable[[bool, int, int], None],
|
||||
timeout: float = 10.0,
|
||||
timeout: float = DEFAULT_BLE_TIMEOUT,
|
||||
) -> Callable[[], None]:
|
||||
self._check_authenticated()
|
||||
|
||||
@ -510,7 +512,10 @@ class APIClient:
|
||||
|
||||
assert self._connection is not None
|
||||
resp = await self._connection.send_message_await_response_complex(
|
||||
BluetoothGATTGetServicesRequest(address=address), do_append, do_stop
|
||||
BluetoothGATTGetServicesRequest(address=address),
|
||||
do_append,
|
||||
do_stop,
|
||||
timeout=DEFAULT_BLE_TIMEOUT,
|
||||
)
|
||||
services = []
|
||||
for msg in resp:
|
||||
@ -518,7 +523,10 @@ class APIClient:
|
||||
return ESPHomeBluetoothGATTServices(address=address, services=services)
|
||||
|
||||
async def bluetooth_gatt_read(
|
||||
self, address: int, characteristic_handle: int, timeout: float = 10.0
|
||||
self,
|
||||
address: int,
|
||||
characteristic_handle: int,
|
||||
timeout: float = DEFAULT_BLE_TIMEOUT,
|
||||
) -> bytearray:
|
||||
self._check_authenticated()
|
||||
|
||||
@ -568,7 +576,7 @@ class APIClient:
|
||||
self,
|
||||
address: int,
|
||||
handle: int,
|
||||
timeout: float = 10.0,
|
||||
timeout: float = DEFAULT_BLE_TIMEOUT,
|
||||
) -> bytearray:
|
||||
self._check_authenticated()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user