Notification delay (#samsung #s10)

I use NodeRed and have a node to call the notify service with the following data:

{
    "title": "{{title}}",
    "message": "{{message}}",
    "data": {
        "data": {
            "ttl": "0",
            "priority": "high"
        },
        "group": "{{group}}",
        "tag": "{{tag}}",
        "color": "{{color}}",
        "sticky": "{{sticky}}",
        "clickAction": "{{clickaction}}",
        "channel": "{{channel}}",
        "image": "{{image}}",
        "importance": "{{importance}}",
        "persistent": "{{persistent}}",
        "timeout": "{{timeout}}",
        "actions": [
            {
                "action": "{{action1}}",
                "title": "{{actiontitle1}}"
            },
            {
                "action": "{{action2}}",
                "title": "{{actiontitle2}}"
            },
            {
                "action": "{{action3}}",
                "title": "{{actiontitle3}}"
            }
        ]
    }
}

This lets me use a change node or something else to just set msg.group, msg.tag, msg.timeout, etc. Notice that ttl: 0 and priority: high are hard coded.

you have ttl and priority in the wrong location…there is only 1 data entry after message and title.

Not according to the documentation page at https://companion.home-assistant.io/docs/notifications/critical-notifications

The example shows this:

automations:
  - alias: 'Fire Detected'
    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

If I get rid of one data: level, the messages dont come through at all.

I just tested this code - result was no message getting sent to me phone:

{
    "title": "Test Title",
    "message": "Test Message",
    "data": {
        "ttl": "0",
        "priority": "high"
    }
}

This worked:

{
    "title": "Test Title",
    "message": "Test Message",
    "data": {
        "data": {
            "ttl": "0",
            "priority": "high"
        }
    }
}

EDIT: And by works, I mean I do get a notification, but still delayed if my screen is off.

Yes pay attention to the example in the docs. There is only 1 data entry after message and title not 2 like you have so ttl and priority are not getting set properly which is why you see a delay.

here is a quick service call I just sent to myself that works and the message comes through immediately, it seems you may be using node red or something and may not be making the proper call:

message: Test 123
data:
  ttl: 0
  priority: high
1 Like

I get the same delays straight out of Dev Tools -> service call as I do Node Red. It seems like a screen on/off thing. All battery saver stuff is turned off for Home Assistant. If screen is off, message is delayed ~15seconds to a few minutes (random). If screen is on, its almost instantly. Pushover has the same battery settings and works all the time regardless. I dont know what the difference is.

One tweak Ill try is to nest ttl and priority under the main data branch, but unquote 0.
So “ttl”: 0 vs “ttl”: “0” Ill have to wait to try this later on and let you know how it goes.

Try using the same service data I used under Dev Tools. I just tested it again with my screen off and it showed up immediately. Literally showed up in about 3 seconds.

image

1 Like

I changed my Node Red code to what you see below. Before, the service call wouldnt work at all when the priority and ttl were listed in the main “data” branch. Now that I changed “ttl”: “0” to “ttl”: 0 (no quotes around 0), it seems to fire, so it looks like it was a data type issue. As for timing, I think notifications are coming in sooner, but not 100% yet. Testing seems to give sporadic results I think because my phone is pretty active at the time. Ill see how things work out throughout today in a more real world test (phone screen off for periods of time and compare Pushover to app notifications).

Regardless, thanks for the assistance as I did find a formatting error that was masking itself.

Here’s my working NodeRed code for the service call:

{
    "title": "{{title}}",
    "message": "{{message}}",
    "data": {
        "ttl": 0,
        "priority": "high",
        "group": "{{group}}",
        "tag": "{{tag}}",
        "color": "{{color}}",
        "sticky": "{{sticky}}",
        "clickAction": "{{clickaction}}",
        "channel": "{{channel}}",
        "image": "{{image}}",
        "importance": "{{importance}}",
        "persistent": "{{persistent}}",
        "timeout": "{{timeout}}",
        "actions": [
            {
                "action": "{{action1}}",
                "title": "{{actiontitle1}}"
            },
            {
                "action": "{{action2}}",
                "title": "{{actiontitle2}}"
            },
            {
                "action": "{{action3}}",
                "title": "{{actiontitle3}}"
            }
        ]
    }
}
1 Like

Update from my end. Things have seemed quicker the last day or two with the code change. Appreciate the help.

1 Like

Thanks so much for the solution, updated my automations and so far no delay observed. :pray:

Hi @gregg098,

Thanks for this example. One small change for you if you want to work with images:
You muse use {{{ else node-red is parsing the image as HTML.

{
    "title": "{{title}}",
    "message": "{{message}}",
    "data": {
        "ttl": 0,
        "priority": "high",
        "group": "{{group}}",
        "tag": "{{tag}}",
        "color": "{{color}}",
        "sticky": "{{sticky}}",
        "clickAction": "{{clickaction}}",
        "channel": "{{channel}}",
        "image": "{{{image}}}",
        "importance": "{{importance}}",
        "persistent": "{{persistent}}",
        "timeout": "{{timeout}}",
        "actions": [
            {
                "action": "{{action1}}",
                "title": "{{actiontitle1}}"
            },
            {
                "action": "{{action2}}",
                "title": "{{actiontitle2}}"
            },
            {
                "action": "{{action3}}",
                "title": "{{actiontitle3}}"
            }
        ]
    }
}

Thanks. Will update. I have not used images yet aside from some basic testing.

I had the same issue with delayed notifications since I switched from an “Honor” Phone to my new Samsung Galaxy S20 FE. It seems to be an issue with Samsungs battery saving implementation. This thread is from 2018 but seems to be stil valid. The fix which is described there is working for me:

There is currently only one temporarly solution working, which is disabling doze using adb console. This workaround is temporarly and works until next reboot. It requires setting phone to debug mode and connecting to it.
“adb shell dumpsys deviceidle disable”

Hope this helps.

I have same problem as described for Redmi Note 8.
Delay in notifications is significant.
I try solution from above:

service: notify.mobile_app_redmi_note_8_pro
data:
  title: Memory use
  message: 'Memory use is: {{states(''sensor.memory_use_percent'')}}%'
  data:
    ttl: 0
    priorty: high

But it doesn’t work for me.
Once mob app goes to sleep it can take a while to receive notification.

I also noticed that problem is not only in notifications but in sensors from phone as well.
They are not update frequently.
Sometimes it passes near 2 hours for sensor to be updated.

BatteryLevel

For example, if I want to be notified when phone battery level drops below some value it’s useless, it’s too slow.

Your issue is due to battery optimizations you need to make sure the app has full access to run in the background. Check the companion docs for troubleshooting steps.

App has access to run in background as well as there is no any power saving restrictions for HA app:

But still I have issues with notifications and sensors updates

On my sasung A70 I have some similar problems.
Sometimes it seems to get blocked for some time before it gets trough.
I for example send this messages (formatted for node red) to my phone and my wife’s phone:

{
    "message": "alarm",
    "data": {
        "ttl": 0,
        "importance": "high",
        "priority": "high",
        "vibrationPattern": "300, 500, 100, 1000, 100, 1000, 100, 1000, 100, 1000, 100, 1000, 100, 1000, 100, 1000, 100, 1000, 100, 1000, 100, 1000, 100",
        "channel": "alarm_stream"
    }
}

The message arrives immediately on my wife’s phone but not on mine. Then I open the Home Assitant Companion app on my phone and see in the configuration settings that my daily allowance of 300 notifications has gone down by two.
After a while I reboot my phone.
Then I again send the message which again arrives on my wife’s phone but not on mine. On my phone I see again my faily allowance has gone down by two.
Then a bit later the two messages I sent to my phone both come in at the same time.

I have followed all the instructions on giving the home assistant apps all the necessary rights and also the instructions listed on https://dontkillmyapp.com/samsung

Is there anything else I can try?

I will also try to send the following under developer tools next time this happens (as suggested by @dshokouhi):

message: Test 123
data:
  ttl: 0
  priority: high

PS: the reason I set priority and importance is that in some of the documentation they mention priority and in other areas they mention importance.

I was seeing significant delays (like upwards of 30 minutes+) between pushover and mobile app. After reading the above I am now trying:

service: notify.mobile_app_vog_l04
data:
  title: Someone is the front door
  message: TTS
  data:
    ttl: 0
    priority: high
    channel: alarm_stream


I came here to share my experience with my S10+. I managed to solve my delay by using “priority” instead of “importance” as well. I’m glad there’s a topic here and that you’re helping others already! I wish I had found this thread before wasting many hours on it.

Look here where I posted what helped me (Disabling IPv6)

I had a similar issue with my SG S10e and most of the apps, that didn’t display notifications instantly. I finally found a fix for it. Please check my post of the solution on Reddit: