Drop bleak_scanner_instance; construct BleakScanner internally#552
Open
Drop bleak_scanner_instance; construct BleakScanner internally#552
Conversation
bleak removed register_detection_callback, so the detection callback must now be passed via the BleakScanner constructor. Accepting an already-built scanner no longer works. Drop the bleak_scanner_instance parameter from Controller and BleController entirely and always construct BleakScanner internally with detection_callback=self._device_detected. This is a breaking change to the Controller signature, but there is no compatible alternative given the upstream bleak removal.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #552 +/- ##
==========================================
- Coverage 75.21% 75.13% -0.09%
==========================================
Files 100 100
Lines 9580 9563 -17
==========================================
- Hits 7206 7185 -21
- Misses 2374 2378 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bleak removed
register_detection_callback, so the detection callback must now be passed via theBleakScannerconstructor. There is no way to add it after construction, so accepting an already-built scanner no longer works.Drop the
bleak_scanner_instanceparameter fromControllerandBleControllerentirely and always constructBleakScanner(detection_callback=self._device_detected)internally inBleController.async_start. Also drop the now-unusedregister_detection_callback(None)call fromasync_stop.This is safe for Home Assistant because
habluetoothalready overwritesBleakScannerby the time we construct it, so the internally-created scanner is the HA-managed one.This is a breaking change to the
Controllersignature, but it is forced by the upstream bleak removal; there is no compatible alternative.