Repository navigation
Inspect plural automation config sections - #1319
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe automation entity extractor is updated to iterate over both singular and plural configuration keys ( ChangesPlural automation section key support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Pull request overview
This pull request updates Spook’s automation unknown-entity detection to correctly inspect Home Assistant’s modern plural automation config sections (e.g., triggers, conditions, actions) in addition to the legacy singular keys, ensuring missing entities aren’t silently missed when raw config uses the new structure (Fixes #1162).
Changes:
- Extend entity extraction to scan both singular and plural automation section keys:
trigger/triggers,condition/conditions,action/actions. - Extend the event-trigger cleanup (that excludes event bus topics) to consider both
triggerandtriggers. - Add tests covering plural-key configs and verifying unknown entities in
conditionsare reported.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
custom_components/spook/ectoplasms/automation/repairs/unknown_entity_references.py |
Scan both singular/plural automation sections for entity extraction; apply event-type cleanup for both trigger and triggers. |
tests/ectoplasms/automation/repairs/test_unknown_entity_references.py |
Add regression tests for plural-key automation configs and unknown-entity reporting from plural conditions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|



Description
Spook now inspects both the legacy singular automation config sections and the modern plural sections when extracting entity references:
triggerandtriggersconditionandconditionsactionandactionsThe event-trigger cleanup that ignores event bus topics also checks both
triggerandtriggers.Motivation and Context
Fixes #1162.
Home Assistant's current automation editor can store automations with plural section keys. Spook only looked at the singular keys in the raw config fallback, so a missing entity in
conditionscould be missed even when the editor itself showed it as unknown.How has this been tested?
uv run pytest tests/ectoplasms/automation/repairs/test_unknown_entity_references.py::test_automation_full_config_with_plural_keys tests/ectoplasms/automation/repairs/test_unknown_entity_references.py::test_plural_condition_entity_is_reported_unknown -quv run pytest tests/ectoplasms/automation/repairs/test_unknown_entity_references.py -quv run ruff format --check custom_components/spook/ectoplasms/automation/repairs/unknown_entity_references.py tests/ectoplasms/automation/repairs/test_unknown_entity_references.pyuv run ruff check --output-format=github custom_components/spook/ectoplasms/automation/repairs/unknown_entity_references.py tests/ectoplasms/automation/repairs/test_unknown_entity_references.pyuv run --with pre-commit pre-commit run pylint --files custom_components/spook/ectoplasms/automation/repairs/unknown_entity_references.py tests/ectoplasms/automation/repairs/test_unknown_entity_references.pyScreenshots (if appropriate):
Not applicable.
Types of changes
Checklist