core
core copied to clipboard
bluetooth: Error stopping scanner
The problem
Similar to #76544.
I'm getting recurring log errors that the bluetooth scanner can not be stopped. This issue was mentioned as fixed in #76544, but it still appears to occur in the latest HA version.
What version of Home Assistant Core has the issue?
core-2022.9.2
What was the last working version of Home Assistant Core?
Issue likely exists since the release of the bluetooth integration
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
bluetooth
Link to integration documentation on our website
https://www.home-assistant.io/integrations/bluetooth/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
hci0 (00:1A:7D:DA:71:15): Error stopping scanner: [org.bluez.Error.Failed] No discovery started
hci0 (00:1A:7D:DA:71:15): Error stopping scanner: [org.bluez.Error.InProgress] Operation already in progress
hci0 (00:1A:7D:DA:71:15): Error stopping scanner: [org.bluez.Error.NotReady] Resource Not Ready
# Also, this warning shows up repeatedly:
Bluetooth adapter hci0 successfully turned back ON
Additional information
I'm not using the bluetooth controller for anything else besides home assistant. I have a Mi Flora plant sensor in use through the "Xiaomi BLE" integration.
bluetooth documentation bluetooth source (message by IssueLinks)
Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (bluetooth) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
The previous fix was to reset the adapter when it stops responding. Ideally the adapter doesn’t stop responding in the first place so it never gets in that state
You best bet is to update bluez and get the latest firmware blobs for your adapter
I've got both the newest bluez version & firmware for my USB adapter (TP-Link UB400 Nano).
I am also receiving the correct status updates from my bluetooth sensor, so I still think this is related to an issue in handling the scanner starting / ending process.
The process for stopping the scanner is a simple call to the bluez dbus api. There isn't anything we can change about it.
There are known issues with the UB400:
https://www.home-assistant.io/integrations/bluetooth#unsupported-adapters
Fair enough, I'll try out a different adapter and will check whether it improves.
I tried it out with an Asus BT500 dongle now - which is listed as supported - but I still get the same error messages logged repeatadly:
hci0 (04:42:1A:5A:15:AD): Error stopping scanner: [org.bluez.Error.Failed] No discovery started
Note: The plant sensor is still being read correctly (which was also the case with my previous dongle). It's just the log messages that show up and I would assume that some of these calls are not handled correctly.
The RTL8167BU based adapters stop responding and have to be reset every so often so that message is expected.
The ones on the High Performance list don't have that issue, but since its working for you its only a problem if its annoys you:
https://www.home-assistant.io/integrations/bluetooth/#known-working-high-performance-adapters
Its likely the kernel will take care of the reset in the future so the message will go away in newer linux kernels but that could take a few months to make it to production: https://lore.kernel.org/netdev/20221006170915.v3.1.I46e98b47be875d0b9abff2d19417c612077d1909@changeid/T/