Notification delay (#samsung #s10)

Did you add ttl and priority like the example in the link up above?

1 Like

Same problem, just had a notification take 2 mins longer to arrive than the telegram notification.

Once it gets one notification it’s ok for a while so it seems to be getting put to sleep somehow.

I have ttl and priority set. I have a Node Red flow that currently sends a Pushover and Home Assistant notification at the same time with the same message for events. Pushover is instant on multiple devices. Home Assistant will come in quick if my screen is on, otherwise it takes up to a few minutes. Battery saver modes and all similar settings are off off my S10.

Yes i have the same issue, on Pixel 4. Created an Alarm channel using high importance, but the notifications are delayed. Hope this will be solved soon!

Can you share an example of a delayed notification?

I use appdaemon for this:

 self.call_service(self.args['frans_notifier'],title=self.args['title'],message=self.args['message'],data={"image":"/local/snaps/voordeur.jpg","channel":"Doorbell","importance":"high","clickAction":"/lovelace/deurbel"})

I want these messages to arrive instantly but they don’t. Also tried a channel with name ‘Alarm’ but same behaviour.

It looks like you completely skipped over what the second post in this thread suggested, you need to set ttl and priority just like the link in that post mentions.

Just follow the android example at the bottom.

If i use priority and ttl i get no notification at all. I need the notification to overrride Do Not DIsturb (so i need the channel); so what would the syntax be with these combined?

EDIT: Ok i changed the line to:

self.call_service(self.args['frans_notifier'],title=self.args['title'],message=self.args['message'],data={"image":"/local/snaps/voordeur.jpg","channel":"Doorbell","importance":"high","clickAction":"/lovelace/deurbel","ttl": 0,"priority":"high"})

And i got notified, will let you know it this work instantly in the next couple of days

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.