home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.8k stars 30.51k forks source link

Homekit-Controller can't pair Danalock #76210

Closed danuvius92 closed 2 years ago

danuvius92 commented 2 years ago

The problem

When i try to pair my Danalock HomeKit Version the HomeKit-Controller detects the Danalock and trys to pair. After the first connection attempt, i get the prompt to enter the Homekit Code. After another try connecting to the Danalock, the prompt to enter the Code shows up again. This process repeats.

What version of Home Assistant Core has the issue?

core-2022.8.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HomeKit-Controller

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit_controller/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-08-04 11:39:44.177 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] Discovered device HASS Bridge C0A00E (HASS Bridge - A0:4E:26:C0:A0:0E)
2022-08-04 11:39:44.177 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] HomeKit device A0:4E:26:C0:A0:0E ignored as already paired
2022-08-04 11:39:44.179 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Ensure connected with device E6:BB:D4:15:75:77: Danalock
2022-08-04 11:39:50.928 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:39:56.662 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:40:03.362 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:40:03.937 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] Discovered device Philips hue - A5737D (BSB002 - DD:B8:84:F1:E2:9F)
2022-08-04 11:40:03.937 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] HomeKit device DD:B8:84:F1:E2:9F ignored as already paired
2022-08-04 11:40:04.085 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] Discovered device IndoorCam 2K-1989 (T8400 - 38:4C:42:67:57:00)
2022-08-04 11:40:04.086 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] HomeKit device 38:4C:42:67:57:00 ignored as already paired
2022-08-04 11:40:08.707 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:40:14.795 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:40:21.655 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:40:27.707 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:40:33.659 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:40:34.244 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:40:34.246 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 85, in establish_connection
    await client.connect(timeout=BLEAK_TIMEOUT)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 167, in connect
    assert_reply(reply)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local

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 43, in establish_connection
    return await retry_establish_connection(
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 117, in establish_connection
    _raise_if_needed(name, exc)
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 78, in _raise_if_needed
    raise BleakConnectionError(msg) from exc
bleak_retry_connector.BleakConnectionError: Danalock (E6:BB:D4:15:75:77): Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local

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 484, in async_step_pair
    self.finish_pairing = await discovery.async_start_pairing(self.hkid)
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/client.py", line 63, in _async_wrap
    return await func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 110, in async_start_pairing
    await self._ensure_connected()
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 85, in _ensure_connected
    self.client = await establish_connection(
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/connection.py", line 51, in establish_connection
    raise AccessoryDisconnectedError(ex) from ex
aiohomekit.exceptions.AccessoryDisconnectedError: Danalock (E6:BB:D4:15:75:77): Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local
2022-08-04 11:41:21.702 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] Discovered device Bosch SHC 10a02b (SMART_HOME_CONTROLLER - D5:40:AD:B9:B0:77)
2022-08-04 11:41:21.702 DEBUG (MainThread) [homeassistant.components.homekit_controller.config_flow] HomeKit device D5:40:AD:B9:B0:77 ignored as already paired
2022-08-04 11:41:21.703 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Ensure connected with device E6:BB:D4:15:75:77: Danalock
2022-08-04 11:41:24.307 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:41:29.682 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:41:35.681 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:41:43.699 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:41:49.729 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:41:55.662 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:42:01.743 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:42:02.112 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:42:07.665 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Danalock (E6:BB:D4:15:75:77): Session closed callback
2022-08-04 11:42:07.666 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 85, in establish_connection
    await client.connect(timeout=BLEAK_TIMEOUT)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 167, in connect
    assert_reply(reply)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local

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 43, in establish_connection
    return await retry_establish_connection(
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 117, in establish_connection
    _raise_if_needed(name, exc)
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 78, in _raise_if_needed
    raise BleakConnectionError(msg) from exc
bleak_retry_connector.BleakConnectionError: Danalock (E6:BB:D4:15:75:77): Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local

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 484, in async_step_pair
    self.finish_pairing = await discovery.async_start_pairing(self.hkid)
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/client.py", line 63, in _async_wrap
    return await func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 110, in async_start_pairing
    await self._ensure_connected()
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 85, in _ensure_connected
    self.client = await establish_connection(
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/connection.py", line 51, in establish_connection
    raise AccessoryDisconnectedError(ex) from ex
aiohomekit.exceptions.AccessoryDisconnectedError: Danalock (E6:BB:D4:15:75:77): Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

homekit_controller documentation homekit_controller source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @jc2k, @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit_controller) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

bdraco commented 2 years ago

le-connection-abort-by-local indicates the connection can't be negotiated.

How far away is the lock from the bluetooth adapter?

Are you using an extension cable? see https://www.home-assistant.io/integrations/bluetooth/#bluetooth-interference-with-other-devices

Also please try 2022.8.1 as it has some improvements for bluetooth devices with poor signal

danuvius92 commented 2 years ago

With 2022.8.1 the pairing worked. Yesterday i tested with the lock unmounted like 1m away of the Gigabyte Brix. Now i have connection problems, the mounted lock is like 4m away of the Brix. But i think its the problem (interference) you mentioned , because i am using the Brix internal bluetooth module and there are some PI's, NAS, Hue Bridge and Dream Router around the Brix. Therefore i ordered a extension cable and a external bluetooth adapter. Will test again when they arrived.

danuvius92 commented 2 years ago

As expected, it now works with the external Bluetooth adapter. I used a extension cable with the Asus USB-BT500. Thx @bdraco