core: Bluetooth proxy not work with HomeKit motion sensor
The problem
I’m trying to connect my ONVIS motion sensor via ESPHome bluetooth proxy. Sensor is HomeKit based. Device is discovered and appears in INTEGRATIONS to configure. Selecting configure and after log delay presents pairing dialog with “An unhandled error occurred while attempting to pair with this device. This may be a temporary failure or your device may not be supported currently.” and pairing fails.
HA Logs:
2022-11-02 11:08:27.011 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 83, in _async_wrap_bluetooth_operation return await func(self, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 319, in get_services esphome_services = await self._client.bluetooth_gatt_get_services( File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/client.py", line 582, in bluetooth_gatt_get_services raise BluetoothGATTAPIError(BluetoothGATTError.from_pb(msg)) aioesphomeapi.core.BluetoothGATTAPIError: Bluetooth GATT Error address=F6:A8:1A:63:82:67 handle=0 error=-1 description=Not connected The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 543, in establish_connection await client.connect( File "/usr/src/homeassistant/homeassistant/components/bluetooth/models.py", line 306, in connect return await super().connect(**kwargs) File "/usr/local/lib/python3.10/site-packages/bleak/__init__.py", line 471, in connect return await self._backend.connect(**kwargs) File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 83, in _async_wrap_bluetooth_operation return await func(self, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 244, in connect await self.get_services(dangerous_use_bleak_cache=dangerous_use_bleak_cache) File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 87, in _async_wrap_bluetooth_operation raise BleakError(str(err)) from err bleak.exc.BleakError: Bluetooth GATT Error address=F6:A8:1A:63:82:67 handle=0 error=-1 description=Not connected The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/connection.py", line 47, in establish_connection return await retry_establish_connection( File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 616, in establish_connection _raise_if_needed(name, description, exc) File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 494, in _raise_if_needed raise BleakConnectionError(msg) from exc bleak_retry_connector.BleakConnectionError: Onvis-SMS1-0b2968 (F6:A8:1A:63:82:67) - F6:A8:1A:63:82:67 -> esp32-bluetooth-proxy-fc1440: Failed to connect: Bluetooth GATT Error address=F6:A8:1A:63:82:67 handle=0 error=-1 description=Not connected The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py", line 479, in async_step_pair self.finish_pairing = await discovery.async_start_pairing(self.hkid) File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 652, in _async_wrap_bluetooth_connection_error_retry return await func(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 151, in async_start_pairing salt, pub_key = await self._async_start_pairing(alias) File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 120, in _async_start_pairing await self._ensure_connected() File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 91, in _ensure_connected self.client = await establish_connection( File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/connection.py", line 57, in establish_connection raise AccessoryDisconnectedError(ex) from ex aiohomekit.exceptions.AccessoryDisconnectedError: Onvis-SMS1-0b2968 (F6:A8:1A:63:82:67) - F6:A8:1A:63:82:67 -> esp32-bluetooth-proxy-fc1440: Failed to connect: Bluetooth GATT Error address=F6:A8:1A:63:82:67 handle=0 error=-1 description=Not connected
What version of Home Assistant Core has the issue?
2022.11.0b7 (tried non-beta Oct releases, too)
What was the last working version of Home Assistant Core?
Never
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Bluetooth Proxy
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
ESPHome
ubstitutions:
name: esp32-bluetooth-proxy-fc1440
packages:
esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
esphome:
name: ${name}
name_add_mac_suffix: false
logger:
level: VERBOSE
esp32:
board: esp-wrover-kit
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
Anything in the logs that might be useful for us?
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (13 by maintainers)
I have that exact model
Onvis-SMS1and it pairs successfully with 2022.11.x and the new esphome code mentioned in that issue.These models do sleep for a long time so you may have to try 2 or 3 times (or pop a battery and reinsert right before trying) to get it to accept a connection though (once you have the new esphome code flashed and 2022.11.x).