Fix HA startup timeout and BLEDevice.rssi AttributeError (0.3.2)#10
Merged
Conversation
Bug fixes found during live testing: 1. Startup timeout (stage 2 bootstrap cancelled) async_config_entry_first_refresh() blocked HA's boot sequence. With multiple sensors at 10-45s per GATT connection, the cumulative time exceeded HA's stage 2 timeout. Replaced with entry.async_create_background_task() so setup returns immediately and the initial audit runs after HA finishes booting. 2. AttributeError: 'BLEDevice' object has no attribute 'rssi' BLEDevice.rssi was removed in newer bleak/habluetooth. Switched to bluetooth.async_last_service_info(hass, mac) which returns the last advertisement data including RSSI and source — the correct HA API. Falls back to None/ble_device.details if service info is unavailable. Tests: Added test_initial_audit_scheduled_as_background_task to verify setup schedules a background task rather than blocking. Added test_source_and_rssi_fallback_when_service_info_none to cover the service_info=None fallback path. Updated test_model_detection_logic to assert RSSI comes from service_info rather than ble_device. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kyleberry
pushed a commit
that referenced
this pull request
Jul 17, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | major | `v6` → `v7` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v7.0.0`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v700) [Compare Source](actions/checkout@v7.0.0...v7.0.0) - Block checking out fork PR for pull\_request\_target and workflow\_run by [@​aiqiaoy](https://github.com/aiqiaoy) in [#​2454](actions/checkout#2454) - Bump actions/publish-immutable-action from 0.0.3 to 0.0.4 in the minor-actions-dependencies group across 1 directory by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2458](actions/checkout#2458) - Bump flatted from 3.3.1 to 3.4.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2460](actions/checkout#2460) - Bump js-yaml from 4.1.0 to 4.2.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2461](actions/checkout#2461) - Bump [@​actions/core](https://github.com/actions/core) and [@​actions/tool-cache](https://github.com/actions/tool-cache) and Remove uuid by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2459](actions/checkout#2459) - upgrade module to esm and update dependencies by [@​aiqiaoy](https://github.com/aiqiaoy) in [#​2463](actions/checkout#2463) - Bump the minor-npm-dependencies group across 1 directory with 3 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2462](actions/checkout#2462) ### [`v7`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v701) [Compare Source](actions/checkout@v6.0.3...v7.0.0) - Bump github/codeql-action from 3 to 4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2475](actions/checkout#2475) - Bump actions/setup-node from 4 to 6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2477](actions/checkout#2477) - Bump docker/build-push-action from 6.5.0 to 7.2.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2478](actions/checkout#2478) - Bump docker/login-action from 3.3.0 to 4.2.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2479](actions/checkout#2479) - Bump actions/checkout from 6 to 7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2488](actions/checkout#2488) - Bump actions/upload-artifact from 4 to 7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2476](actions/checkout#2476) - eslint 9 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2474](actions/checkout#2474) - Bump the minor-actions-dependencies group with 2 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2499](actions/checkout#2499) - skip running unsafe pr check if input is default by [@​aiqiaoy](https://github.com/aiqiaoy) in [#​2518](actions/checkout#2518) - trim only ascii whitespace for branch by [@​aiqiaoy](https://github.com/aiqiaoy) in [#​2521](actions/checkout#2521) - escape values passed to --unset by [@​aiqiaoy](https://github.com/aiqiaoy) in [#​2530](actions/checkout#2530) </details> --- ### Configuration 📅 **Schedule**: (in timezone America/Chicago) - Branch creation - "on monday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDkuNSIsInVwZGF0ZWRJblZlciI6IjQzLjI0OS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://gitea.berry.house/kyleberry/sensorpush_local/pulls/10
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.
Bug fixes found during live testing:
Startup timeout (stage 2 bootstrap cancelled) async_config_entry_first_refresh() blocked HA's boot sequence. With multiple sensors at 10-45s per GATT connection, the cumulative time exceeded HA's stage 2 timeout. Replaced with entry.async_create_background_task() so setup returns immediately and the initial audit runs after HA finishes booting.
AttributeError: 'BLEDevice' object has no attribute 'rssi' BLEDevice.rssi was removed in newer bleak/habluetooth. Switched to bluetooth.async_last_service_info(hass, mac) which returns the last advertisement data including RSSI and source — the correct HA API. Falls back to None/ble_device.details if service info is unavailable.
Tests:
Added test_initial_audit_scheduled_as_background_task to verify setup schedules a background task rather than blocking. Added test_source_and_rssi_fallback_when_service_info_none to cover the service_info=None fallback path. Updated test_model_detection_logic to assert RSSI comes from service_info rather than ble_device.