Repository navigation
Ignore event payloads in automation repair checks - #1312
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughTwo recursive helper functions are added to the automation repair modules: ChangesAutomation Repair: Suppress Event Trigger False Positives
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
00f2988 to
eca7a61
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes false-positive “unknown entity/device reference” repairs caused by event-trigger payload metadata being interpreted as Home Assistant registry references in automations.
Changes:
- Excludes
event_typestrings from unknown-entity reference detection (while still scanningevent_data.entity_id). - Excludes
event_data.device_idvalues in event triggers from unknown-device reference detection. - Adds/extends regression tests to cover the corrected behavior for both entity and device repairs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
custom_components/spook/ectoplasms/automation/repairs/unknown_entity_references.py |
Filters out event trigger event_type values from the unknown-entity repair computation. |
custom_components/spook/ectoplasms/automation/repairs/unknown_device_references.py |
Filters out event trigger event_data.device_id values from the unknown-device repair computation. |
tests/ectoplasms/automation/repairs/test_unknown_entity_references.py |
Adds regression coverage ensuring event event_type does not get treated/reported as an unknown entity reference. |
tests/ectoplasms/automation/repairs/test_unknown_device_references.py |
Adds regression coverage ensuring event payload event_data.device_id does not get treated/reported as an unknown device reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|



Description
Spook now ignores event-trigger payload metadata when checking automation references.
This keeps
event_typevalues liketimer.finishedout of the unknown entity repair, while still checking real entities fromevent_data.entity_id.It also ignores
event_data.device_idvalues for event triggers in the unknown device repair, since those values are event payload data and not Home Assistant device registry references.Motivation and Context
Event trigger payloads can contain strings that look like Home Assistant references, but are not references owned by the automation.
Fixes #1213.
Refs #1081.
How has this been tested?
uv run pytest tests/ectoplasms/automation/repairs -quv run pytest tests/ectoplasms/automation/repairs tests/test_translations.py -quv run ruff format --check .uv run ruff check --output-format=github .uv run --with pre-commit pre-commit run pylint --files custom_components/spook/ectoplasms/automation/repairs/unknown_entity_references.py custom_components/spook/ectoplasms/automation/repairs/unknown_device_references.py tests/ectoplasms/automation/repairs/test_unknown_entity_references.py tests/ectoplasms/automation/repairs/test_unknown_device_references.pyScreenshots (if appropriate):
Not applicable.
Types of changes
Checklist