Closed literally-anything closed 1 month ago
That's curious, it worked for me in background while I was testing, the only thing is that you can't call it infinitely, iOS restricts the number of times you can update and how often too
Yeah, I'll test it again when the limit resets.
Now the notification just appears as an alert in Notification Center. It’s strange because it only seems to happen sometimes.
I checked with Zac and the command also needs to be flagged by firebase push in here: https://github.com/home-assistant/mobile-apps-fcm-push
I merged a PR there, now it should be good, at least I don't see the notification anymore consistently.
But the same restrictions from Apple apply https://developer.apple.com/documentation/widgetkit/keeping-a-widget-up-to-date
You can keep an eye on how often it updates with a template like this:
{{ states['sensor.date_time'].state }}
The alerts stopped appearing now, but it still won't seem to update without the app in the foreground. I'll try again when the limit resets tomorrow.
It's weird, sometimes it works reliably for me and sometimes it stops working for a while, it must be some Apple safe guard to prevent excessive usage of refresh widgets timelines
After a few days testing apparently iOS decides when the background update will happen, I also read on Apple forums more people discussing about this and even though the update doesnt happen right away, the OS is notified that "this widget requested updates as soon as allowed".
I'll be closing this issue for now since I don't think it's under our control to force the update to happen always, please let me know in case you believe we should reopen.
iOS device model, version and app version Model Name: iPhone 13 Software Version: iOS 18 beta 3 App version: 2024.711
Home Assistant Core Version 2024.7.1
Describe the bug The
update_widgets
notification command only works if the mobile app is in the foreground.To Reproduce
update_widgets
command from another device or automation. The widgets will not updateExpected behavior The widgets should update with the app in the background. This works completely if you open the app in the foreground and pull down Notification Center from there, just not in the background.
Additional context From my pull request that was merged a few days ago: https://github.com/home-assistant/iOS/pull/2830
My best guess as to why this doesn’t work is that I used the main dispatch queue which only seems to run in the ui thread. https://github.com/home-assistant/iOS/blob/2c838a1c70338607998f47e0444aa4637f2fd078/Sources/Shared/Notifications/NotificationCommands/NotificationsCommandManager.swift#L121-L125 I would try testing this, but in my builds I can’t get my own firebase app connected properly.