Notifications to the phone will not be displayed until it is unlocked

Hello,

please advise what to set.
I have set up automation to send notifications to my mobile phone (Galaxy S10e, Android 11).
Automation works properly, but notifications on the mobile phone are displayed when I unlock the mobile phone. Respectively, when I wake up the phone.
I have notifications enabled on the lock screen, Home Assistant has background activity enabled, battery optimization is off.
I don’t know what else to set up.
As soon as I wake up the phone, all the notifications will come.

1 Like

sounds like you are not setting ttl and priority for the critical notifications

Make sure to follow the android examples: https://companion.home-assistant.io/docs/notifications/critical-notifications

Thank you for answer. I tried to set it up, but a message appears stating that automation cannot be set.
Where is the problem please?

id: '1608657778007'
  alias: Notifikace dveřní senzor poštovní schránka
  description: ''
  trigger:
  - type: opened
    platform: device
    device_id: 6d134307bb6b4422dfc6b5fbe4a84d34
    entity_id: binary_sensor.openclose_6
    domain: binary_sensor
  condition: []
  action:
  - device_id: b217d35d300b78be20b279023bb2367c
    domain: mobile_app
    type: notify
    message: Pošta!
    title: Poštovní schránka
    ttl: 0
    priority: high
  mode: single

Invalid format make sure you follow the examples closely.

I forgot the line “data.”
Automation was already functional after adding the “data” line, but the notification still did not appear on the sleeping phone. The notification came when I woke up the phone manually. I had to enable the adaptive battery in the phone settings and remove the Home Assistant application from the list of applications that are not optimized in the special access settings. Furthermore, in the developer options in the application section in standby mode, it is necessary to verify that the Home Asssistant is in the ACTIVE category. Now the notification is OK. A sound sounds and the icon is displayed on the Always on display. The whole display does not light up (eg as when an SMS arrives) but it does not matter.

The code now looks like this:

id: '1608657778007'
  alias: Notifikace dveřní senzor poštovní schránka
  description: ''
  trigger:
  - type: opened
    platform: device
    device_id: 6d134307bb6b4422dfc6b5fbe4a84d34
    entity_id: binary_sensor.openclose_6
    domain: binary_sensor
  condition: []
  action:
  - device_id: b217d35d300b78be20b279023bb2367c
    domain: mobile_app
    type: notify
    message: Pošta!
    title: Poštovní schránka
    data:
      ttl: 0
      priority: high
  mode: single
2 Likes

I dig this one up, because I have the same issue, also with a Samsung phone.
I tried every channel and configuration listed in the documentation (Critical notifications | Home Assistant Companion Docs) but nothing works. On my Samsung S9 / Android 10, I only receive the notification if I unlock the phone. If the phone is locked, no notification comes through. Not even the LED starts blinking, nor a vibration pattern works.
If the phone is unlocked, I get the vibration (however vibrationPattern seems to have no effect…) and the notification is shown immediately.

This is the configuration I use in the automation:

action:
  - service: notify.mobile_app_sm_g960f
    data:
      title: Coffee!
      message: I need coffee!
      data:
        ttl: 0
        priority: high
        media_stream: alarm_stream
        channel: alarm_stream
        importance: high
        notification_icon: mdi:coffee-maker-check
        visibility: public
        ledColor: red

I do not see why it should not work?
The App is removed from the battery optimization. I checked the DND overwrite for the alarm_stream channel.

Is this yet another Samsung power saving feature, which hinders the notification to show?

HA core: 2023.06.1 / App version: 2023.3.0-full

edit: All of a sudden it started to work - kind of. I get now a vibration (but still not the vibration pattern) but the LED is not blinking (It is when using the alarm_stream channel but always red. Looks like the color cannot be overwritten here?). What also does not work is to overwrite the ringer so that I get a acoustic ping on the notification. The media_stream: alarm_stream should do that - or not?
I also had to add channel: alarm_stream to the data, otherwise it would go into the General channel…

Resurrecting this Old Post since it’s the first one I found related to my issue.
On my pixel 9 Pro XL phone, I have the home assistant app set to not battery optimized, allow background usage, all notification content on lock screen, and to notify on several notification channels.
For example I have several time sensitive security related automations using the critical Channel and I do not receive these in a timely fashion when the phone screen is off and locked.
But when I awaken the phone screen and unlock it, the notifications then arrive immediately.
It appears to be a known issue across Android phones and I was hoping someone new of a fix.

UPDATE:
I added TTL in priority to my automation action section as shown below. Let’s see if this resolves the issue.

  - action: notify.mobile_app_pixel_9_pro_xl
    metadata: {}
    data:
      message: "Backyard Slider door left opened! "
      data:
        channel: Critical
        ttl: 0
        priority: high

UPDATE:
Adding ttl and priority like above appears to have resolved the issue with me getting immediate Audible notifications when my screen is off and locked.
I can also confirm that new Android 15 ‘notification cooldown’ feature does not negatively impact this either.

Follow the critical notification example in the links above, it is still relevant

1 Like

Thank you for getting back to me, I updated my above :point_up:post and added the TTL and priority lines. Let’s see if this resolves the issue.

Yep, adding ttl and priority to the action notification appears to resolve my issue. I updated my post above,:point_up:. Thank you

1 Like

Wrong post lol

1 Like

Thanks for the heads up! :sunglasses: