From 0c5d1099519e6c674da35e5d7ad8f2f13ac6d0b2 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 28 Sep 2022 12:06:20 +1300 Subject: [PATCH] Add failed callback --- aioesphomeapi/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aioesphomeapi/client.py b/aioesphomeapi/client.py index e5282bd..f7d28e5 100644 --- a/aioesphomeapi/client.py +++ b/aioesphomeapi/client.py @@ -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(