Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow response and warn logs for Nuki #262

Closed
itairaz1 opened this issue Dec 2, 2022 · 5 comments
Closed

Slow response and warn logs for Nuki #262

itairaz1 opened this issue Dec 2, 2022 · 5 comments

Comments

@itairaz1
Copy link

itairaz1 commented Dec 2, 2022

Hi,
I just paired my Nuki device (BLE) to homeassistant (If I need to post this issue there and not here, please let me know) and when I tried to perform an operation (lock/unlock) it respond after few seconds, but as soon as I perform more operations (right after), they respond immediately. The operating become slow again after a while (not sure, something like 1 minute).
In the log I see many warn message goes like:
WARNING (MainThread) [aiohomekit.pdu] Transaction 57 failed with error 6 (Invalid request)
While the transaction number is different.
I can post also debug log, but i'm not sure if it contains confidential information, so please let me know.
Thanks you a lot for all the contribution and help!

@bdraco
Copy link
Collaborator

bdraco commented Dec 2, 2022

Its normal for it to be a bit slow to reconnect since it only holds the connection for a few seconds after an operation, but taking a whole minute to reconnect is not normal. At most it should take 15s, at best 1-2s with a high performance adapter https://www.home-assistant.io/integrations/bluetooth/#known-working-high-performance-adapters.

If you enable debug logs for bleak_retry_connector and aiohomekit you can see why its taking so long to reconnect.

@Jc2k
Copy link
Owner

Jc2k commented Dec 2, 2022

Hi

In general it's better to raise issues in the HA repo first. In this case the maintainers are the same, but you could easily be pinging strangers about HA misusing their library. Also, HA has a template that prompts you to give us the bare minimum of info about your environment (HA version, how HA is installed, diagnostics report).

If it generally works but is slow we'd usually start by looking at environmental factors.

So as above - What HA? What is it running on? How is it installed?

What is the model of lock?

Have you got any other homekit devices working with HA? One about other Bluetooth ones?

Have you turned on the signal strength sensor, and what is that looking like?

Are you using a Bluetooth dongle? Is it on the list of "high performance" dongles? Are you using HA OS? Is it up to date? Are you using any esphome proxies?

@itairaz1
Copy link
Author

itairaz1 commented Dec 2, 2022

@bdraco @Jc2k Thanks for reply
@bdraco I wasn't clear enough. It takes around 5-10 seconds (not 1 minute), so it seemed to be normal.
Is there a way to send operation to maintain/prepare a connection inadvance? so I can use it before I know there is a high chance I'm going to use the device.

@Jc2k Sorry, next time I will post directly to HA repo

So as above - What HA? What is it running on? How is it installed?

I'm using latest HA 2022.11.5. running on Raspberry Pi 4 64bit model B using latest HA OS 9.3.

What is the model of lock?

Nuki Smart Lock 3.0

Have you got any other homekit devices working with HA? One about other Bluetooth ones?

No

Have you turned on the signal strength sensor, and what is that looking like?

-85dBm

Are you using a Bluetooth dongle? Is it on the list of "high performance" dongles? Are you using HA OS? Is it up to date? Are you using any esphome proxies?

No dongle, I'm using Raspberry Pi 4B hardware.
Raspberry Pi 4B listed as high performance
Using latest HA OS 9.3
No, I'm not using any esphome proxies?

@Jc2k
Copy link
Owner

Jc2k commented Dec 2, 2022

85 is on the weak side. You are likely seeing packet loss, connection failures etc which won't be helping performance.

An external dongle closer to the lock (ideally with an extension to help avoid noise from usb3 etc) and that is from the high performance list might help.

Alternatively you could try using an esphome device as a "Bluetooth proxy" range extender. These are looking like they will be pretty stable for homekit when 2022.12 is out.

2022.12 includes fixes that should make connection setup slightly faster, but this will be dwarfed by connection failure due to a weak signal.

Homekit Bluetooth devices aggressively disconnect to conserve battery, so we can't keep connections up. Also there are limits to how many active connections can be sustained on the host side (5 active connections is considered a good setup). We also go to great lengths to avoid connecting (sensors don't need us to connect and read at all any more). But when we do connect we have to wait for the lock to turn its radio on. This means that the worst case could be always be a little slow.

@itairaz1
Copy link
Author

itairaz1 commented Dec 2, 2022

@Jc2k Thank you for all the information. It is now more clear.
I think you can close the ticket.

@Jc2k Jc2k closed this as completed Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants