ronengr / hass_nuki_bt

Control Nuki Lock over bluetooth
MIT License
32 stars 7 forks source link

Unable to connect 2 Nuki Smart Lock 3.0 devices #25

Closed Ayuus closed 8 months ago

Ayuus commented 8 months ago

System Health details

Everything runs as normal

Checklist

Describe the issue

I have 2 Nuki devices, both on latest firmware (3.7.7). Each one of them works OK if connected (discovery etc works really well, thanks!), but the second one is detected, but cannot be configured. This is independent of which of the 2 devices is connected first.

Is this integration supposed to support multiple Nuki Smart Lock 3.0 devices?

Reproduction steps

  1. Configure a Nuki Smart Lock 3.0
  2. Observe this smart lock works OK
  3. Configure another Nuki Smart Lock 3.0
  4. Observe that initialisation failed. ...

Debug logs

In the HA System log:

Detected that custom integration 'hass_nuki_bt' attempted to call BleakClient with an address instead of a BLEDevice at custom_components/hass_nuki_bt/config_flow.py, line 151: ret = await device.pair(), please create a bug report at https://github.com/ronengr/hass_nuki_bt/issues

followed by (5 secs later)

config/custom_components/hass_nuki_bt/config_flow.py:166: RuntimeWarning: coroutine 'NukiDevice.disconnect' was never awaited device.disconnect()


### Diagnostics dump

_No response_
Ayuus commented 8 months ago

After configuring a second Bluetooth proxy, both locks work. Nor\t ideal, as in HA, the bluetooth integration is supposed to be able to connect 5 devices.

Ayuus commented 8 months ago

Hmmm... seems I was wrong, for some reason, both locks now work on the same BT Adapter...

petosiso commented 7 months ago

Hi, I have exactly same problem - unable to connect my second Nuki Lock 3.0 device. The second device appears in HA as an iBeacon tracker. Do you have any recommendations?

ronengr commented 7 months ago

I have no idea. I have only one Nuki so i cannot test this. Do you have any logs?

petosiso commented 7 months ago

There is nothing in HA system log. I am trying to add the second device manually but also without success. Just to be sure, does the DeviceID also mean the BT address? image

ronengr commented 7 months ago

Device address is BT address. note that it should be in the format 38:8B:DC:F4

Regarding the logs, If you enable debug-logging for the integration before trying to add the 2nd device maybe we will get some more info.

petosiso commented 7 months ago

Unfortunately, the modified format did not help. The form just flashes and doesn't even throw any error.

My first NUKI device immediately appeared under Homekit integration and works very well. I don't have any Nuki BT integration listed - that seems strange to me. Because of that, I don't even know where to turn on debug-logging.

image

I can see only your "New Nuki device" poup form after clicking on "Add integration".

image

ronengr commented 7 months ago

if you go to settings -> devices & services you will see a list of all your enabled integrations. you can find Nuki there. depending on you HA version, either click on the 3 dots or on the integration and select "enable debug logging" Screenshot from 2023-11-27 22-51-57

or click on the integration end then you will see the option inside: Screenshot from 2023-11-27 22-49-09

petosiso commented 7 months ago

As I mentioned, there is no Nuki integration in list. My first Nuki device is under HomeKit integration.

image

Ayuus commented 7 months ago

Hi, I have exactly same problem - unable to connect my second Nuki Lock 3.0 device. The second device appears in HA as an iBeacon tracker. Do you have any recommendations?

I ignored iBeacon integration, so maybe that is the difference? Both my Nuki locks work OK via the USB BT adapter I installed on the HA server.

ronengr commented 7 months ago

As I mentioned, there is no Nuki integration in list. My first Nuki device is under HomeKit integration.

I have no idea about HomeKit integration. if i understand correctly, you didn't use hass_nuki_bt for the first lock? so this is basically only one lock you are trying to connect to hass_nuki_bt?

petosiso commented 7 months ago

No, you didn't understand correctly. I have had HomeKit integration for a long time. I control the gate through it. Today I received 2 Nuki Locks devices, so:

1 - I found your hass_nuki_bt integration and installed it via HACS. 2 - I restarted HA. 3 - HA automatically discovered a new Nuki Lock device throught your integration. To be honest, I am not sure if it was your or homekit integration. I added this device to HA (Configure button) 4 - This first Nuki Lock immediately appeared under HomeKit integration and your integration is not listed. 5 - I cannot add the second Nuki Lock device in any way.

Maybe tomorrow I'll try to remove your integration and repeat the procedure...

I feel like the two integrations got mixed together because Nuki natively supports HomeKit - it's kind of like google home, only from Apple. https://nuki.io/en/homekit/

Ayuus commented 7 months ago

No, you didn't understand correctly. I have had HomeKit integration for a long time. I control the gate through it. Today I received 2 Nuki Locks devices, so:

1 - I found your hass_nuki_bt integration and installed it via HACS. 2 - I restarted HA. 3 - HA automatically discovered a new Nuki Lock device throught your integration. To be honest, I am not sure if it was your or homekit integration. I added this device to HA (Configure button) 4 - This first Nuki Lock immediately appeared under HomeKit integration and your integration is not listed. 5 - I cannot add the second Nuki Lock device in any way.

Maybe tomorrow I'll try to remove your integration and repeat the procedure...

I feel like the two integrations got mixed together because Nuki natively supports HomeKit - it's kind of like google home, only from Apple. https://nuki.io/en/homekit/

I would ignore Homekit Integration and try again. If necessary, add Nuki Locks manually via Nuki BT Integration.

petosiso commented 7 months ago

So, I removed the device from HomeKit integration. I deleted your NukiBT integration. Then I reinstalled it and restarted HA. Now I can't even add a single NukiBT device...

Adding NukiBT manually doesn't work either - just like yesterday. After clicking Submit, nothing happens. But it's possible that DeviceID isn't BT address. I found this DeviceID in official Nuki app, can't find BT address.

image

petosiso commented 7 months ago

OK, I found BT address of Nuki lock throught some android app from Google Play. This appears in logs:

File "/usr/src/homeassistant/homeassistant/components/bluetooth/wrappers.py", line 375, in _async_get_best_available_backend_and_device raise BleakError( bleak.exc.BleakError: No backend with an available connection slot that can reach address 54:D2:72:8C:75:EC was found

Ayuus commented 7 months ago

Sounds like you do not have a Bluetooth adapter installed in your HA server, nor a Bluetooth proxy that can be reached from yoy HA server.