mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-11-28 13:05:12 +01:00
Add failed callback
This commit is contained in:
parent
86512bc607
commit
0c5d109951
@ -447,6 +447,7 @@ class APIClient:
|
||||
self,
|
||||
address: int,
|
||||
on_bluetooth_connection_state: Callable[[bool, int], None],
|
||||
on_bluetooth_connection_failed: Callable[[], None],
|
||||
timeout: float = 10.0,
|
||||
) -> Callable[[], None]:
|
||||
self._check_authenticated()
|
||||
@ -458,6 +459,8 @@ class APIClient:
|
||||
resp = BluetoothDeviceConnection.from_pb(msg)
|
||||
if address == resp.address:
|
||||
on_bluetooth_connection_state(resp.connected, resp.mtu)
|
||||
if resp.failed:
|
||||
on_bluetooth_connection_failed()
|
||||
|
||||
assert self._connection is not None
|
||||
await self._connection.send_message_callback_response(
|
||||
|
Loading…
Reference in New Issue
Block a user