Some help on Android Notifications & NodeRED

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

service: notify.mobile_app_andreas
data:
  message: command_dnd
  data:
    command: alarms_only

?

Sorry, I mean it’ll trun off the DND, but not the silent

So only the bottom one goes off
image

And without both being off it doesn’t let the notification through still

This:

service: notify.mobile_app_andreas
data:
  message: command_dnd
  data:
    command: "off"

or this:

Notification Commands | Home Assistant Companion Docs (home-assistant.io)

That’s what I’m using - it only turns off one of them
Not to worry - I guess it’s just a foible of MiUI :frowning:

Did you try what I linked to?

Oh apologies - link just looked like the general documentation link!

That’s the ticket :slight_smile: Thank you!

Is there any way to grab the current state of those items?
EDIT: Answering my own question… just need to enable the sensors in the app

Amazingly managed to work out myself how to store and use variables…!

I came across a couple of foibles which may help others in the future if they’re searching

  1. If you don’t add a delay, the statuses will switch back before the notification has had chance to enact the sound
  2. It seems that if you try and send a silent command after the DND command it doesn’t do anything… the other way around works fine. No idea why (as I can set them in that order in the UI), but nevermind

I’d love to think of a way to do this without an arbitrary delay, but for now I think it does the job!

Now just to make it a subflow and allow me to send the message / title / device via a different flow :slight_smile:

Is there any way to use msg.payload as part of the entity check?

EDIT:
Well, I’ve sort of found a way! Seems {{ phone }} in the entity name can work :slight_smile:


No idea if this is the correct way to do it but seems to be working!

We can’t possibly help from a picture alone.