-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[bluetooth] Fix disappearing bluetooth devices in Inbox #10187
Conversation
f7054c5
to
2fedb21
Compare
The rssi is highly variable and can change many times a second. Discovery recalculation should only occur if the previous result expired or there is new immutable information about the device that might cause it to get discovered differently. Signal strength is not "immutable" information and as such should not cause a new discovery attempt. |
…like Inbox Signed-off-by: Peter Rosenberg <prosenb.dev@gmail.com>
2fedb21
to
4cda3ad
Compare
Thanks for the explanation. Yes, that could change too often then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @PRosenb, this is awesome! I had exactly the same issue and tried to fix it with #10154, which miserably failed.
I tested your fix and can confirm that it is working nicely - I now have a stable list of devices in the inbox on subsequent scans.
@cpmeister Ieave merging to you as you're the expert for the code in question.
If you allow, I have to agree with @PRosenb that the discovery code is tough to read and it gave me a hard time - so hard that I didn't feel comfortable of doing changes to it...
...rc/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDiscoveryService.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Peter Rosenberg <prosenb.dev@gmail.com>
* [bluetooth] Notify things again when they are removed from listeners like Inbox * [bluetooth] Add javadoc on retractDiscoveryResult() Signed-off-by: Peter Rosenberg <prosenb.dev@gmail.com> Signed-off-by: John Marshall <john.marshall.au@gmail.com>
* [bluetooth] Notify things again when they are removed from listeners like Inbox * [bluetooth] Add javadoc on retractDiscoveryResult() Signed-off-by: Peter Rosenberg <prosenb.dev@gmail.com>
* [bluetooth] Notify things again when they are removed from listeners like Inbox * [bluetooth] Add javadoc on retractDiscoveryResult() Signed-off-by: Peter Rosenberg <prosenb.dev@gmail.com>
* [bluetooth] Notify things again when they are removed from listeners like Inbox * [bluetooth] Add javadoc on retractDiscoveryResult() Signed-off-by: Peter Rosenberg <prosenb.dev@gmail.com>
I had troubles with detecting Bluetooth devices. On first scan, it listed multiple devices but when I did the scan again a bit later, the list was mostly empty.
The code that handles Bluetooth device detection is quite complex (too complex I feel). I analysed the code and used the debugger to get a basic understanding.
Suggested changes to improve Bluetooth device detection: