Redirect repairs to the first view with unknown entities#1172
Redirect repairs to the first view with unknown entities#1172piitaya wants to merge 3 commits intofrenck:mainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe entity extraction was refactored: __async_extract_entities now returns a dict mapping entity_id -> view_path (int|string) instead of a set. Call sites were updated to use mapping keys for unknown-entity checks and mapping values to construct edit URLs using /{url_path}/{first_view_path}?edit=1. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py`:
- Around line 71-72: unknown_entities is a set so using
next(iter(unknown_entities)) yields an arbitrary entity; to pick the first
unknown entity by view order, iterate the insertion-ordered mapping
extracted_entities and select the first key present in unknown_entities, then
assign its value to first_view_path (update the code around first_view_path =
extracted_entities[next(iter(unknown_entities))] to search
extracted_entities.keys() for the first key in unknown_entities).
custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py`:
- Around line 71-76: The StopIteration is caused by keys in extracted_entities
containing comma-separated raw strings while async_filter_known_entity_ids
returns split entity IDs; update __async_extract_entities to normalize/split and
strip comma-separated entity strings into individual keys (e.g., produce entries
for "light.a" and "light.b" rather than "light.a, light.b") so the lookup used
by the next(...) that computes first_view_path against unknown_entities
succeeds; ensure extracted_entities remains a mapping from single entity_id ->
path and adjust any deduplication logic accordingly.
custom_components/spook/ectoplasms/lovelace/repairs/unknown_entity_references.py
Show resolved
Hide resolved
|



Description
Redirect repairs to the first view with unknown entities
Motivation and Context
Previously, the "unknown entity references" repair always linked to view
0regardless of which view actually contained the missing entity. This made it harder for users to find and fix the issue, especially in dashboards with many views.Now the repair link points directly to the first view that contains an unknown entity, using the view's path if set or falling back to the view index.
How has this been tested?
Manual testing with dashboards containing multiple views where unknown entities exist in views other than the first one.
Screenshots (if appropriate):
Types of changes
Checklist