-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Lock SwitchBot Bluetooth connection takes a long time when using local adapter but OK with proxy #93171
Comments
Hey there @OttoWinter, @jesserockz, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) esphome documentation |
If its slow when NOT using the proxy but fast when using the proxy, its a problem with the local adapter. Which bluetooth adapter are you using? |
Hey there @Danielhiversen, @RenierM26, @murtas, @Eloston, @dsypniewski, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) switchbot documentation |
now iam using UGREEN CM109 (CSR8510A10) |
It looks like the connection get dropped almost right away. We will probably need the |
ok, i will turn on logging debug level for bleak and as soon as i get proper logs i will write here, thanks |
below LOG
|
That looks like either the buggy firmware on the RTL8761BU (anything older than 0xDFC6_D922 is pretty broken from my experience or an interference problem. Which adapter are you using? |
as i wrote posts before
this adapter has CSR chip not RTL :/ I dont think so, that this is interference, because:
|
Sorry about that, thats a known good adapter -- jumping between this and another issue and trying to not mix them up 👍 I think at this point we need a btmon dump to see what is going on lower in the bluetooth stack. https://github.com/bluez/bluez/wiki/btmon#capture-the-traces-from-hci0-to-hcidumplog-file |
@bdraco btmon: command not found |
I do some update. I placed bt dongle about 2m near lock, clean area, no walls, nothing. BT signal: about -40rssi - -50rssi. One bt proxy Update HA to newest esphome update too today log:
I noticed, that all logs contain always: RSSI: -71 |
after update to newest ESPHome 2023.5.4 (problem still exsist)
|
also using this for an extension cable |
lock setup and connected fine. config flow took a bit longer than expected but ok |
its pretty quick for me. Here is my connection log with various debug loggers enabled
|
Also I'm using this hardware for the HA system https://www.hardkernel.com/shop/odroid-n2-with-4gbyte-ram-2/ |
i dont know what to say, but as i wrote many times (and some other users too): lock working ok after reboot, manual open/close, some action on it. But, wait about 30min, 1h and more and then is problem - i had lag and have to wait for action. Lock i dont know, goes to sleep mode ? now i know that NO, but behavior is like this. |
I waited 25 minutes from the last attempt and result is the same, still quick to connect
I'll try again in an hour |
It seems like you have an integration or a core change in recent versions that is making your system. You could try the dump command instead or record |
|
|
Looks like the number of threads is ok with |
when do record HA freeze and restart i see that i have python v3.10.11 and You have v3.11.3. this can do problem or not? |
2023.6.0 will have python 3.11 It comes out next Wednesday so maybe it would be good to try again than |
i dont know wht to do more. Something is wrong, but all working ok. I have many devices and automations and all working ok. Now with only btproxy lock working ok too. |
System Information
Home Assistant Community Store
Home Assistant Cloud
GIOŚ
Home Assistant Supervisor
Dashboards
Recorder
Spotify
|
today i made test. I disabled all integrations, all devices. Stays onlu Supervisor, reboot HA and run in terminal py-spy command as below: and HA freeze and after about 10 minutes rebooted |
after update HA to 2023.6.0 py-spy working! here is svg file after command:
|
Great. Can you zip up the file before posting? GitHub compresses them and mutates them. also if you can capture at a higher rate that would help |
ok @bdraco done with sample: 100 150 200 500 |
The websocket looks a bit busy. If you open the inspector panel in your browser, how fast are the messages coming in? |
You mean: open HA in browser (in my case: newest chrome) right click and INSPECT? If yes, its open about 1 sec or less. I can say: right away |
I think the problem is likely higher up the bluetooth stack in bluez or bleak I just found hbldh/bleak#1329 but there seems to be more issues |
I setup an x86_64 intel nuc system with the exact same adapter (I moved it from an aarch64 ARM system) and I'm having trouble with it as well. It works perfectly fine on the aarch64 ARM system It seems like the problem is in the kernel or bluez |
ok, thanks for this work. big thanks |
hbldh/bleak#1329 will fix the cases where we wait the whole timeout for the device to reappear |
fixes #93036 (comment) fixes #93222 (comment) fixes #93171 changelog: hbldh/bleak@v0.20.2...v0.21.0
#99520 will fix the case where the device is removed from the bus while connecting and than we take a long time to timeout. If that doesn't fix it we can reopen this case and hopefully the new logging will give us a hint what is going on. |
The problem
@bdraco
Iam using HA with Yours fix esphome folder in dir custom component and all as i wrote in this #90265 thread worked fine.
BUT
When i see new verison 2023.5.3 HA included this fix i delete esphome dir from custom component dir and update HA. This was 14 may. Today is 16 may, i tested many scenario, and i have to say that something is wrong. Something another than before.
Now problem is, that connection not go via bt-proxy and this make another delay. I not made any change in my config, only one change was: delete esphome folder from custom component and update HA to 2023.5.3. When connection is via bt-proxy all is ok and without delay. But i dont know why, not every connection going via bt-proxy. Before update to 2023.5.3 everyome lock connection go via bt-proxy
what to do?
Below logs when connection go via proxy and NOT (via app: tap unlock and when unlocked tap lock and lock locked)
What version of Home Assistant Core has the issue?
2023.5.3
What was the last working version of Home Assistant Core?
2023.5.2 with custom fix and earlier
What type of installation are you running?
Home Assistant OS
Integration causing the issue
ESPHome
Link to integration documentation on our website
https://www.home-assistant.io/integrations/esphome
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response
The text was updated successfully, but these errors were encountered: