Skip to content

Centralize app domains; adjust widget and intent#4428

Merged
bgoncal merged 5 commits intomainfrom
widget-domain-handle
Mar 10, 2026
Merged

Centralize app domains; adjust widget and intent#4428
bgoncal merged 5 commits intomainfrom
widget-domain-handle

Conversation

@bgoncal
Copy link
Member

@bgoncal bgoncal commented Mar 10, 2026

Summary

Introduce HAAppUsedContent to centralize the list of Home Assistant domains and provide rawValues. Use HAAppUsedContent.rawValues in AppEntitiesModel to filter entities (removing the local domains list). Update EntityAddToHandler to only add CustomWidgetAction when the entity's Domain can be constructed and is included in HAAppUsedContent.domains. Change MagicItem's default interactionType from a refresh app intent to a navigateIntent that opens the entity deep link (AppConstants.openEntityDeeplinkURL). These changes restrict widget availability to supported domains and make default item interactions navigate directly to the entity.

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Copilot AI review requested due to automatic review settings March 10, 2026 14:02
@bgoncal bgoncal self-assigned this Mar 10, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes the list of Home Assistant domains used throughout the app by introducing HAAppUsedContent as a single source of truth. Previously, AppEntitiesModel maintained its own local domain list for entity filtering. Now, this list is shared, and both entity filtering and widget availability checks use it. Additionally, the default widget interaction type for unrecognized domains is updated from a no-op refresh intent to a navigate intent that opens the entity's detail/more-info deeplink.

Changes:

  • Introduces HAAppUsedContent enum with a static domains list and rawValues computed property, replacing the local domainsAppUse private list in AppEntitiesModel.
  • Updates EntityAddToHandler to gate the CustomWidgetAction behind a domain check using HAAppUsedContent.domains, so unsupported domains no longer offer the widget option.
  • Changes MagicItem.widgetInteractionType's default branch from .appIntent(.refresh) to a navigate intent (navigateIntent(url:)) pointing to the entity's deeplink.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Sources/Shared/API/Models/AppEntitiesModel.swift Introduces HAAppUsedContent public enum with centralized domain list; replaces local domainsAppUse with HAAppUsedContent.rawValues
Sources/App/Frontend/ExternalMessageBus/EntityAddToHandler.swift Adds domain check before appending CustomWidgetAction, restricting widget option to HAAppUsedContent.domains
Sources/Shared/MagicItem/MagicItem.swift Changes default widget interaction from .appIntent(.refresh) to a deeplink navigate intent

@bgoncal bgoncal enabled auto-merge (squash) March 10, 2026 14:30
@bgoncal bgoncal merged commit b2c6e87 into main Mar 10, 2026
12 checks passed
@bgoncal bgoncal deleted the widget-domain-handle branch March 10, 2026 14:57
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@8db76db). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff           @@
##             main   #4428   +/-   ##
======================================
  Coverage        ?       0           
======================================
  Files           ?       0           
  Lines           ?       0           
  Branches        ?       0           
======================================
  Hits            ?       0           
  Misses          ?       0           
  Partials        ?       0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants