I am using a frigate automation blueprint to receive notifications on my Android device. The notifications are delayed if my phone is locked. When I unlock my phone I will get the notification, sometimes straight away and other times several minutes later.
I had this issue using my hikvision nvr and app and I thought moving to home assistant would overcome this but it is actually worse.
Before moving to HA I read that with the latest update to the companion app there was a change to the way notifications were handled. They were previously handled by Google but were now sent by the HA server. Apparently this meant they were received immediately every time and also didn’t count towards the rate limit.
I have set the persistent notification to always on and I see this in my notification tray. But the notifications are still delayed, even though the automation shows it was triggered. The notifications are also set to critical. I have checked my log and I seen an entry showing that I had reached the limit of 500 notifications. But if I am using the persistent notification then this shouldnt happen?
Do I need to do something else to set this up correctly?
I am using the full app from the play store, version 2022.6.0 and HA OS 8.1.
Any help appreciated.
Forgot to mention that I also set up another automation to send a notification just to confirm that it is not an issue with the blueprint. I would receive these notifications for a few minutes after my phone phone locks and then they would stop. After unlocking the phone all the notifications would come through.
critical is not used in android.
That is a iOS setting.
Priority was what I was supposed to link to earlier.
Here is the example from the docs:
automations:
- alias: "Fire Detected android"
trigger:
- platform: state
entity_id: sensor.smoke_alarm
to: "smoke"
action:
- service: notify.mobile_app_<your_device_id_here>
data:
title: "Wake up!"
message: "The house is on fire and the cat's stuck in the dryer!"
data:
ttl: 0
priority: high
I have changed all power saving settings and the app is not optimised.
Will try this. I thought the critical setting would take care of it, didn’t realise it was ios only. Not sure how to change it as I am using a blueprint. I’ll try to copy the code from automation debug and paste in to a new automation with the priority setting.
Edit: I have just read through the blueprint info and it states that the critical option should give faster notifications on android. It does include ttl and priority in the code.
I will try my own automation with the priority settings and see if it makes any difference
This is also just pretty normal when using the default notifications (Firebase). They will come through much quicker if you enable the persistent connection in Android HA settings.
I setup a simple automation so that when I put phone on charge there will be a delay of 15 minutes. It will then send a low priority notification, wait 20 seconds and then send a high priority notification.
I wanted to see if the high priority came through even if the low priority failed.
Occasionally both come through on time. Other times there would be no notifications so I waited a few minutes. Even when I then wake up the phone they don’t come through, and even if I open the HA app it can still take a couple of minutes more before they arrive.
So it seems there is no difference between the low and high priority. There was not a single occasion where the low failed and the high came through. They either both fail or both show.
Here is the code. Have I set this up ok or is there any error on my part.
You can open the companion app settings, view previous notifications, and see if they were delivered with FCM or the persistent connection. In my case, no matter the priority, persistent connection notifications are always delivered instantly
I just had a look, it seems both methods are being used. Even on the same day some are sent by FCM and some by websocket. How can I make sure it always uses the persistent connection. I have already set it to always on
I have read through the ha docs and it states that ttl and priority only have an impact if not using local push notifications (persistent notification).
As I am using this then ttl and priority should not be needed and in any case wouldn’t make any difference.
This issue I have is that even though I have the persistent notification set to always, I have checked the notification history and they are still being sent using both FCM and webhook. There does not seem to be any pattern to explain what method is used. Why is the setting not being implemented.
What can I do to force the use of webhook notifications. Really need this to work so any ideas are appreciated
I’m not sure if that is correct. I think local notifications refers to those sent directly from home assistant using websocket rather than FCM, not local address.
I am using cloudflare for remote access. It works remotely with websocket for instant notifications. I have now realised that it is a device issue, the persistent notification is closing after my phone is asleep for a few minutes. When I wake the phone the notification icon would be gone and restart when I open the app. If I keep the phone awake it remains active and notifications are instant every time, using websocket even after several hours.
I have tried a different phone today and it seems to keep the persistent notification active even after the phone sleeps. It responds instantly every time.
So the issue seems to be on the device side. I have set both phones up with the same power settings but one still seems to be having issues keeping the connection.
Did you find a solution to this other than changing devices?
I am having the same issue on my galaxy s21 ultra.
Latest updates for HA. As soon as I unlock my phone I get flooded with notifications.
I will try persistent notifications. But the last time I noticed a huge battery draw. Maybe that’s been improved.
Your issue is probably that it is a Samsung.
Samsung have their OneUI with many extra power saving features, but there seems to be no way to control them.
I have a Nokia that works perfectly, because it runs a vanilla Android, but I also got a Samsung from my work and that one cause nothing but problems.
The Samsung will deploy power saving features when it thinks it is appropriate and it will suddenly restart and install updates when it thinks it is appropriate. I seems like Samsung thinks they know your life better than you.
Thank you, I will try this. Can I add this at the group level so all notifications use these settings? Or will they get overridden?
If I have them set at the notify group level, but then call the group using the settings for TTS in an automation, will the settings in the automation override what is set at the group level?
Thank you everyone, sad it’s a Samsung issue. Maybe I should switch to telegram or signal notifications instead for critical alerts.