Repository navigation
Link devices by device id instead of deprecated identifiers - #2187
Closed
purcell-lab wants to merge 1 commit into
Closed
purcell-lab wants to merge 1 commit into
purcell-lab wants to merge 1 commit into
Conversation
Home Assistant deprecated the via_device identifier tuple on device_registry.async_get_or_create and in entity DeviceInfo (removed in 2027.8), and reading device_registry.devices as a mapping (removed in 2027.9). Live logs reported both from __init__.py and chargepoint.py. - Charger devices link to the central system by its device id; a charger that shares the central system's identifier (merged into one device) is not linked to itself, which via_device_id would reject. - Connector devices resolve their charger's device id in this config entry through a shared connector_device_info helper. - update() walks the entry's devices with async_entries_for_config_entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGcSLnKvwwLo96gDatnNT5
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2187 +/- ##
==========================================
+ Coverage 97.30% 97.34% +0.04%
==========================================
Files 12 13 +1
Lines 4265 4375 +110
==========================================
+ Hits 4150 4259 +109
- Misses 115 116 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was successfully deployed
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.
Fixes #2140
Summary
Home Assistant 2026.9/2026.10 logs two deprecations from this integration:
device_registry.async_get_or_createcalled with the deprecatedvia_deviceparameter (__init__.py); this stops working in 2027.8.0. The same applies toDeviceInfo(via_device=…)on the connector entities (sensor, number, switch, button). HA reports only the first occurrence per integration, so these don't appear in the log.device_registry.devicesused as a mapping (chargepoint.py,dr.devices.values()); this stops working in 2027.9.0.Changes
via_device_id=<central device id>. When a charger shares the central system's identifier, HA merges the two into one device. That device is now left unlinked, becausevia_device_idrejects a self-reference; the old tuple form silently ignored it.devices.connector_device_info()builds the connectorDeviceInfowithvia_device_id, resolved from the charger device in the same config entry. If that device can't be found, the connector is left unlinked rather than failing.ChargePoint.update()walks the entry's devices withdevice_registry.async_entries_for_config_entryinstead of iteratingdr.devices.values(). That helper is available on all supported HA versions.async_entries_for_config_entry;test_charger_device_linked_to_central_system_without_deprecationasserts the link resolves and novia_devicedeprecation is logged.Validation
main(e6a95c5). The only conflict was an import line innumber.pynext to the new TxDefaultProfile option.pytest tests: 567 passed.ruff checkandruff format --check: clean.ocppdevice-registry deprecation warnings, and charger and connector devices keep their hierarchy.Home Assistant deprecated the via_device identifier tuple on device_registry.async_get_or_create and in entity DeviceInfo (removed in 2027.8), and reading device_registry.devices as a mapping (removed in 2027.9). Live logs reported both from init.py and chargepoint.py.
Claude-Session: https://claude.ai/code/session_01CGcSLnKvwwLo96gDatnNT5
Summary by CodeRabbit