Add UnifiedPush support to Home-Assistant Android / Core

UnifiedPush allows multiple, different apps (like Home-Assistant) to use a single notification push server which a user can configure. It is like Google’s Firebase Cloud Messages, however with the difference that users can choose, which “distributor” they choose and what servers they trust to relay their notifications. However, it is overall better than using a direct Websocket connection to the Home-Assistant server itself because (assuming many apps are using UnifiedPush like FCM) the phone of the user is only required to maintain a single connection (in difference to every app maintaining their own) which saves battery & cellular data usage.

You can find more about the original concept here.
UnifiedPush was already discussed in issue #1480 for Home-Assistant Core (cannot post a link as new users can only post 2 in the beginning).
It was an idea to solve the problem that F-Droid users were not able to receive notifications at all. Still I think implementing UnifiedPush would improve Home-Assistant more.
UnifiedPush is already implemented in other Android apps. One example is Element for Android.

What would be required to implement? The Android client would need to check for any UnifiedPush distributor installed, would need to register itself there. It then receives a push URL as target for HTTP requests and needs to inform its Home-Assistant Server about this new push URL. The Home-Assistant Server (probably implemented in the Core) would need to save this URL and push future notifications to this client via the given URL.

For Android, there is already a library implemented which can do this in a similar shape like the official FCM library by Google. There is also one version which can automatically fallback to FCM if no UnifiedPush provider can be found on the device. You can find information for Android developer at the official UnifiedPush page and it probably helps to see what Element needed to change (see PR linked above) to migrate from FCM support only to UnifiedPush + FCM support.

Sadly, I’m not a Android developer, so I hope to find someone who might can implement this to Home-Assistant. When I have enough time, I could try to implement it, however, without guarantee. I should be able to assist in testing the feature.

I second this feature request. Those of us who don’t have Google Play Services — pretty much all of the privacy-on-Android community, such as GrapheneOS users and more — can’t get notifications at all unless UnifiedPush is implemented.

Here is the bug tracked in the companion app tracker: Support UnifiedPush · Issue #3174 · home-assistant/android · GitHub

1 Like

This paragraph is more or less on the money. There needs to be an API endpoint in HA that receives the NTFY/UP POST URL + an encryption key, and that API endpoint needs to associate the URL with the Companion client. Then, when HA needs to send a notification, there needs to be an additional implementation of push that looks up the POST URL then POSTs the necessary data through the UP server (encrypted with the pre-agreed key). The Companion app would then receive the notification from the distributor, decode it using the pre-agreed key, and process the data as usual using the same routine that processes push messages today.

1 Like

It’s even easier than that, because it looks like the core already supports WebPush. That’s enough to be able to support UnifiedPush!

I asked the UnifiedPush devs, and added their comments about this to the android app issue #3174.

Whoa super cool thanks for that liaison!

unfortunately its still not that simple, the current mobile_app integration is still dependent on firebase and if not using local push will default to doing things like rate limiting notifications. Considerations will need to be made in the integration before the app should support it.

1 Like

Yep, part of the ask is to let the mobile-app integration be informed by companion clients what backend to push to, and if the selected backend isn’t firebase but rather ntfy, then it should do the ntfy push thing instead.

For what it’s worth, notifications themselves already work with via an add to the configuration.yaml. Details are in this repo: GitHub - ivanmihov/ Home Assistant integration for, but it’s basically just a json post.

Adding my support for UnifiedPush as well, though, as being able to untangle myself from depending on Play Services being enabled at an application level would be far better than hacking on push notifications via an add to my config.


It would be nice to have this made easier to set up of course, but here’s one way to do it:

  • In the nextpush application: create a Notification Channel.
  • Press long on the notification channel entiry. After a small while you can “copy” the channel - this copies the notification URL.
  • With that URL create a RESTful Command:
       url: 'NEXTCLOUD_INSTANCE/index.php/apps/uppush/push/XXXX'
       method: post
       payload: '{{ message }}'

Now you have a new rest_command that you can call as a service with a message parameter:

- service: rest_command.notify_nextpush_user
    message: "Hello from Home Assistant"