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.

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
1 Like

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…