android icon indicating copy to clipboard operation
android copied to clipboard

Add support for UnifiedPush notifications

Open lone-faerie opened this issue 10 months ago • 4 comments

Summary

Adds support for using UnifiedPush as the source for push notifications. This allows both the full and minimal flavors to receive push notifications without a persistent websocket connection and without reliance on Google's Firebase Cloud Messaging. On launch, UnifiedPush is preferred if a distributor is available, otherwise the full flavor falls back to FCM. A setting has also been added to allow the user to manually select the UnifiedPush distributor to use.

Checklist

  • [ ] New or updated tests have been added to cover the changes following the testing guidelines.
  • [x] The code follows the project's code style and best_practices.
  • [x] The changes have been thoroughly tested, and edge cases have been considered.
  • [x] Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.

Screenshots

UnifiedPush Setting Distributor Selection

Link to pull request in documentation repositories

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

Any other notes

https://github.com/home-assistant/android/issues/3174 mentions Home Assistant Core needing to add support before this would work. I'm not sure if it's changed since then, but in my tests UnifiedPush works with Core as-is. A small change to Core would be needed to support encrypting the notifications, but that isn't necessary for UnifiedPush to work.

lone-faerie avatar May 01 '25 22:05 lone-faerie

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar May 01 '25 22:05 home-assistant[bot]

While this works to get started (and is quite similar in some ways to my proof of concept from last year), I feel like there should be a generic interface here. This approach doesn't scale and the push provider can change without the user noticing.

jpelgrom avatar May 02 '25 05:05 jpelgrom

The push provider should only change during onboarding or if the user uninstalls the distributor app. A generic interface does feel like the more proper approach though, perhaps something like the SensorManager. UnifiedPush also has the ability to handle FCM on it's own, though that would require a bit of backend work since it needs a gateway similar to the current cloud functions.

lone-faerie avatar May 02 '25 18:05 lone-faerie

Since you are changing the notification, you will also need two others PR in the developer documentation.

TimoPtr avatar May 12 '25 09:05 TimoPtr