Repository navigation
Conversation
A BPS device is keyed by its tracker's Bermuda prefix, so renaming or
dropping a tracker leaves an empty device behind, and Home Assistant
refuses to delete it ("Config entry does not support device removal")
because BPS has no async_remove_config_entry_device.
Add it, allowing removal only when the device holds no entities. A device
that still has BPS sensors is kept, since the next update would just
re-create it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
Each tracked device gets a BPS device keyed by its Bermuda prefix (
("bps", device_key)insensor.py). When a tracker is renamed or dropped (for example, a private BLE device whose Bermuda name changes), the old BPS device is left behind with no entities. Home Assistant won't let you delete it:That's because BPS doesn't implement
async_remove_config_entry_device. Empty BPS devices pile up and can't be deleted from the UI.Change
Adds
async_remove_config_entry_devicetocustom_components/bps/__init__.py. It allows removal only when the device has no entities (disabled ones included). A device that still has BPS sensors is kept, because the next update would only re-create it.Testing
tests/test_device_removal.py: unit tests for both cases against the existing stubbed-HA suite. Full suite:56 passed.config/device_registry/remove_config_entryWebSocket command the UI's Delete sends:main: an empty BPS device is refused withConfig entry does not support device removal.success: True). A device that still has a BPS sensor is refused (rejected by integration) and stays in the registry.🤖 Generated with Claude Code