fix: replace BleakClient.connect() with establish_connection() and add exponential backoff#6
Open
bpinson999 wants to merge 1 commit into
Conversation
…d exponential backoff - Use bleak_retry_connector.establish_connection() instead of BleakClient.connect() directly, resolving the habluetooth.wrappers warning about unreliable connections - Use async_ble_device_from_address() to check HA BT registry before attempting connection; device not advertising now logs at DEBUG instead of WARNING - Catch BleakNotFoundError separately to avoid noisy WARNING logs when device is off - Add exponential backoff in _run() loop (5s base, doubles each failure, 300s cap) to prevent log spam when device is unavailable for extended periods - Use asyncio.wait_for(stop_event.wait()) for backoff sleep so stop() wakes the loop immediately instead of waiting out the full delay - Add _on_disconnect callback for clean state reset on unexpected disconnection - Pass hass instance into VolcanoBTManager constructor
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.
Closes #5
What this fixes
When the vaporizer is unplugged or out of range, the integration spammed the HA log with 126,000+ warning-level entries in a ~2 hour window. See #5 for the full problem description.
Changes
bluetooth_coordinator.py__init__.pyTested
Verified with the device unplugged. Backoff progression confirmed in logs (5s → 10s → 20s → ...). No habluetooth.wrappers warnings observed. Zero log spam.
AI Disclosure
This fix was developed with assistance from Claude. All changes were reviewed, tested, and verified by me on a live Home Assistant instance.