Add push-based widget updates#4939
Conversation
Refactor HAWidgetPushHandler to register one push subscription per widget kind, keyed by a stable per-kind subscription_id, and extract tracked entities for the sensors, todo-list and custom widgets. Apply the push handler to the todo-list and custom widget configurations. Gauge, details and commonly-used widgets are intentionally excluded: their values come from server-rendered templates or dynamic usage prediction, so there is no static entity list to subscribe.
Add HAWidgetPushHandler (iOS 26 WidgetPushHandler) and the haWidgetPushHandlerIfAvailable() modifier so the sensor widget registers its widget push token and tracked entity_ids with the server for push-driven timeline reloads. Also fix WidgetSensors.body, which bound the configuration to `let config` without returning it and prevented the Widgets extension from compiling. Includes only the project.pbxproj entries that add the two new files to the Widgets target; signing/team changes are intentionally excluded.
Extend HAWidgetPushHandler to build one push subscription per widget kind (sensors, todoList, custom) with a stable per-kind subscription_id, extracting each widget's tracked entity_ids from its configuration intent. Gauge and details are excluded (template-driven) as is commonlyUsedEntities (dynamic), since they have no fixed entity list to subscribe.
There was a problem hiding this comment.
Pull request overview
Adds iOS 26 WidgetKit push support so selected widgets can refresh via APNs-triggered timeline reloads instead of relying solely on scheduled timelines.
Changes:
- Introduces an iOS 26
WidgetPushHandler(HAWidgetPushHandler) that registers a widget push token + trackedentity_idsto Home Assistant via a newregister_push_subscriptionwebhook call. - Applies the push handler (via a
WidgetConfigurationmodifier) to widgets with a fixed entity list: Sensors, To-do List, and Custom. - Updates the Xcode project to include the new widget push handler sources.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/Extensions/Widgets/TodoList/WidgetTodoList.swift | Attaches the push handler modifier to the To-do List widget configuration. |
| Sources/Extensions/Widgets/Sensor/WidgetSensors.swift | Attaches the push handler modifier to the Sensors widget configuration. |
| Sources/Extensions/Widgets/Sensor/HAWidgetPushHandler.swift | New iOS 26 WidgetPushHandler implementation that registers push subscriptions per widget kind. |
| Sources/Extensions/Widgets/Custom/WidgetCustom.swift | Attaches the push handler modifier to the Custom widget configuration. |
| Sources/Extensions/Widgets/Common/WidgetPushHandlerModifier.swift | New modifier to conditionally apply pushHandler(...) on iOS 26+. |
| HomeAssistant.xcodeproj/project.pbxproj | Adds the new Swift sources to the appropriate build targets/groups. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Remove the Xcode-style file header blocks from the new widget push files, matching the repo convention for widget sources. - Stop logging any part of the widget push token; log only counts/context. - Log webhook registration failures instead of silently swallowing them with try?, so a failed registration is diagnosable.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4939 +/- ##
=======================================
Coverage ? 51.83%
=======================================
Files ? 298
Lines ? 19482
Branches ? 0
=======================================
Hits ? 10099
Misses ? 9383
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| Task { | ||
| do { | ||
| try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in | ||
| Current.webhooks.sendEphemeral(server: server, request: request) |
There was a problem hiding this comment.
If this fails, when will it be retried?
|
Keeping it draft while we dont have the core PR ready, since all depends on that merged first |
|
Please in all PR's you opened add a footer with link to all related PRs:
So it's easier to navigate between them |
Summary
Adds iOS 26 WidgetKit push support so widgets refresh via push instead of only
on the system's timeline schedule.
Using the new iOS 26
WidgetPushHandlerAPI, aHAWidgetPushHandlerisattached to the data widgets. When the system issues a widget push token, the
handler registers that token together with the widget's tracked
entity_idswith the connected Home Assistant server, via the new
register_push_subscriptionwebhook command. When any of those entities change, the server sends an APNs
widgetspush and WidgetKit reloads the widget's timeline — no polling.Covered widgets (those with a fixed, configured entity list):
Deliberately excluded:
is no fixed entity list to subscribe to
subscription would go stale
Also fixes a build break in
WidgetSensorswhosebodybound the configurationto
let configwithout returning it, which prevented the Widgets extension fromcompiling.
Screenshots
No new UI — this is a background refresh mechanism. Existing widgets simply
reload their content sooner (on entity change) instead of waiting for the next
scheduled timeline reload.
After Widget Push Notification

Before Widget Push Notification

Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes
This is the iOS portion of a three-part feature:
(
register_push_subscriptionwebhook + entity-change tracking):Add entity-change push subscriptions to mobile_app core#174943
WidgetPushHandlerthat registers the widget pushtoken and tracked entities
widgetspush from thesubscription payload (separate change)
The Widgets extension needs the Push Notifications capability
(
aps-environment) added for the system to issue a widget push token. I leftthat out of this PR because it's signing/capability configuration rather than
code — flagging it for the mobile team to add.
Validated end-to-end on a real iOS 26.5 device for the Sensors widget: the
handler registered the token + entities, an entity change triggered an APNs
widgetspush, and the widget reloaded with the new value. To-do and Customcompile and follow the identical registration path.
Related Pull Requests
Core - home-assistant/core#174943
FCM - home-assistant/mobile-apps-fcm-push#337
Note: the fork's distribute/CI job fails at code signing (it needs the repo's
signing secrets, which forks don't have) — not a code issue.