Make sure mobile notifications arrive

Problem:

I’ve recently started working with notifications for mobile devices, some of them with actions etc.
Then my phone restarted on its own and just during this time I would have received a notification but I didn’t get it because the phone was still offline.
Now - this problem also exists if you happen to lose cell signal or are in a very crowded place where not much data is available per cell user so it could happen quite often.

Solution:

HA needs to make sure that all target devices also receive all notifications fired.

Approach:

There are two possible approaches:

  • The mobile app fires an event once it receives a notification, containing some data to identify which notification it is.
    It is up to the HA admin to build an automation that makes sure that the notifications arrive
    This would also require the notification integration to be modified to fire an event with sent notifications.

  • HA has a backend notification queue with timestamps that the mobile app “pulls” it’s notifications from when it is online.
    The timestamps are to display the correct notification date on the mobile app.

Maybe there would also be another way but I couldn’t think of any more.

Maybe vote for your own request? :wink:
In the meantime you could also consider using the Signal Messenger integration or alike? What I like about that is that you also get a history of messages to look back at, and in Signal you can set the chat to forget that history after a certain amount of time after it was read.

Are you using the minimal version of the app or the play store version?

The minimal version has these issues because it can only deliver notifications when the phone is connected to HA via websockets. The play store version should not because it uses Google’s queue service as a fallback when the phone is not connected and that should deliver them later when your phone is online.

That being said I have had trouble with googles service. I have noticed before that sometimes I was missing notifications. It wasn’t when my phone was powered off, it seemed to be related to some kind of deep sleep mode. Possibly in conjunction with low ttl although I was never able to consistently reproduce it.

It did happen enough that I basically created what youre describing for myself. I have a .notification_queue.json file in my /config folder, a script that I use for sending notifications which decides whether to send or queue them and an automation that manages sending things out of the queue later. So I guess I’ll vote for this so I don’t have to maintain that myself. Although I have to say I haven’t tried going without this custom queue in many months so it may not be necessary anymore, I’m sure there’s been improvements in both Google’s queue service and the mobile app integration.

I am using the playstore version of the app, I am using LineageOS (with all google packages) which may be the reason for my sub-optimal experience, however I believe that the experience of the app should be the same across all device vendors and android flavours, hence it should be handled by HA themselfs.

Maybe you could share your “current” setup through a gist on github?

I am quite new to this forum (and I’d rather have put this on github) but thanks for telling me!

Having a message history would be great, tho using a seperate (let alone entirely unrelated) app for this should not be needed if done properly.
Also theoretically all Android versions above 9 do keep a notification history already. It can be accessed through the Device Settings > Sound & Notifications.

This is now part of the latest beta version of the Android app. Already on GitHub, should be live in the play store in a day or 2 just waiting on Google to review the app.

If you set ttl to 0 you tell FCM deliver it immediately or not at all so if the device is offline it won’t show up.

Not possible when some devices don’t support FCM at all like the minimal version of the app. This really only impacts users who don’t want Google services. In those cases your should not expect things to be apples to apples. It’s a decision the user makes to move away from a Google certified device by changing the software.

There already is notification history in app.

This is great! can’t wait to play with it!

I agree, those who make this decision will have to live with tradeoffs.
However LineageOS is built from Android’s source code and has long had FCM support.
Installing the google service packet that is mandatory for any other google apps will make sure it is enabled!

Also good to hear the notif history in-app. Don’t spend much time there as the UI still is a little clumsy in some places, not very inviting (Some easy, starter stuff is buried in menus where it belongs but newbies don’t go there ^^)’

in which parts are you referring to? The android app itself only controls whats inside Configuration > Companion App. Everything else is the HA frontend.