Some help on Android Notifications & NodeRED

Ah - that’s likely part of it, but even removing that I still don’t get anything with the priority settings

(I’m looking at here btw: Critical notifications | Home Assistant Companion Docs (home-assistant.io))

Are you following the correct example, Apple/Android?

I believe so (unless I’ve screwed up the code interpretation to Node Red somehow)

I’m on Android and using the Android Alarm Stream

The example works fine as a service call. Didn’t try it in node red but it uses the same service calls so it should work

Looks like all the quotes were the issue…

That said, while it puts a little icon on the notification it doesn’t seem to break through my silent anyway!

Now having an issue getting the Text to Speech to work…

I get “Please Set A Title for Text To Speech to Process” whatever I try…
Checked this thread: Android mobile_app Notify + TTS Stopped Working - Configuration - Home Assistant Community (home-assistant.io) and not having any luck with solutions there :frowning:

I’ve tried putting title everywhere I can lol and still get the same result!

{"message": "TTS", 
 "title": "The house is on fire and the cat's stuck in the dryer!",
 "data": {
    title: "The house is on fire and the cat's stuck in the dryer!",
    ttl: 0,
    priority: high,
    media_stream: alarm_stream_max,
    tts_text: "The house is on fire and the cat's stuck in the dryer!"
    }
}

Do not use a title key in any part of a tts message, from the documentation. You need one for text and another for tts


        data:
          message: TTS
          data:
            ttl: 0
            priority: high
            media_stream: alarm_stream_max
            tts_text: "The house is on fire and the cat's stuck in the dryer!"
1 Like

You need to issue a notification using a channel you have created - eg “announce” or “critical” or something. Then in Android after you have received the notification, you can go in to the notification settings, and for that specific channel you can change the ringtone and allow it to break through Do Not Disturb.

data:
  title: Flood Alert!
  message: Attention! There is a flood!
  data:
    ttl: 0
    priority: high
    media_stream: #whatever you want
    channel: important_alerts

If you do not include a channel, it will always be posted to the default channel in the app. You can have as many channels as you like.

2 Likes

Yup this! Set a channel (whatever you want to call it i.e. emergency). Then once you get the notification on your device, long hold on the notification until you get the settings cog. Tap that. You will then get a list of all notification channels for that specific app. Find the one you selected for this channel and tap it. You then get to select the notification settings for that specific channel. You can set if it pops, the sound, vibration etc. Would recommend the override do not disturb setting for something like this.

1 Like

Thanks! I think I either missed the bit about the channel in the docs or it wasn’t clear how to make it work!
Appreciate the detailed instruction

So I’m still having some difficulties with this…

This is what I have in my NodeRed Data filed

{"message": "A FLOOD HAS BEEN DETECTED - DO SOMETHING!!!",
"title":"WARNING: FLOOD DETECTED",
"data": {
      ttl: 0,
      priority: high,
      media_stream: alarm_stream,
      channel: Important_Alerts
    }
}

I get the notification but my phone doesnt seem to add anything to the settings

I only have the three categories…

I’m guessing my code is somehow malformed - in other data fields I have everything in quotes, but if I put in quotes (e.g. "priority": "high") but on this one if I add the quotes I get no notification at all…

Any advice?!

You are using JSON.
JSON does not allow keys and string values to be without quotes.
In yaml you can use without quotes sometimes, but JSON does not allow that.

But if I add the quotes I get no notifcation at all… nothing
Am I writing it wrong?

{"message": "A FLOOD HAS BEEN DETECTED - DO SOMETHING!!!",
"title":"WARNING: FLOOD DETECTED",
"data": {
      "ttl": "0",
      "priority": "high",
      "media_stream": "alarm_stream",
      "channel": "Important_Alerts"
    }
}

EDIT: So the above gives me no notification

I tested it and it works fine.

[{"id":"09c0c3eb0bca45c9","type":"api-call-service","z":"ebaa69a9.649708","name":"","server":"4bbca37b.1700ec","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_andreas","areaId":[],"deviceId":[],"entityId":[],"data":"{\t    \"message\": \"A FLOOD HAS BEEN DETECTED - DO SOMETHING!!!\",\t    \"title\":\"WARNING: FLOOD DETECTED\",\t    \"data\": {\t        \"ttl\": 0,\t        \"priority\": \"high\",\t        \"media_stream\": \"alarm_stream\",\t        \"channel\": \"Important_Alerts\"\t    }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":420,"y":620,"wires":[[]]},{"id":"8341ddf8ceda3de9","type":"inject","z":"ebaa69a9.649708","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":620,"wires":[["09c0c3eb0bca45c9"]]},{"id":"4bbca37b.1700ec","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
1 Like

Well, that worked

The only difference I can see is in spacing and your "ttl": 0 not having quotes around the zero

Because 0 is not a string value. I didn’t expect it to break the notification though.

1 Like

I now get the Important_Alerts option in my notification settings for the app, but doesn’t seem like I have an option to break through the silent/dnd :frowning:

EDIT: Looks like it’s a MiUI oddity :frowning:

You could send a notification command to turn off DND, then the notification and turn on DND again.

Oooh… good idea… will look into that

Also, seems the channel doesnt come through if you send it to a group of phones as opposed to an individual one

Urgh… Can disable DND but doesnt seem to be a command for silent… :frowning:
Think I’ll just use the Alertify app