Who will notify.notify notify?

Hello, newbie here, sorry for my (probably) stupid question. I’ve been setting up hangouts and gmail smtp notifications, which work under their own service (notify.hangouts and notify.gmail), but can’t get them to work as expected under the notify.notify service.

If I understood correctly, notify.notify should notify all platforms. Is that correct? Because when calling notify.notify I am only getting notifications in the mobile App, which I haven’t even configured. I am not trying to configure a group, only trying to understand what is notify.notify supposed to do.

Thank you in advance.

2 Likes

See this post:

2 Likes

It notifies all the people.
If you use notify.your_phone it will be just you.
notify.notify sends the notification for everybody with the app who is logged in in your home assistant (family, friends and everybody you share your HA).
If you need something special, you need to change the notifications, for example notify.whatsapp (with callmebot).
So be careful with sensitive information you notify.

No it does not. Read my post above.

Also as evidenced by observations in the original question:

Thank you for your answers. Sorry to bother, but I still don’t get it though.

I am not really trying to notify all with a group, I just would like to understand why it is behaving like that. I’ve been searching for info on how notify.notify works to no avail, and it is really frustrating.

This makes sense, as it is exactly how it is behaving.

I’m sure this makes sense, but I don’t understand it… which notification platform is used if you don’t specify it through service name? If I go to “Services > developer tools”, invoke “notify.notify” and simpy provide a message, it will be sent without specifying any platform. Is there any “default platform” which happens to be in-app messages?

Thank you again.

What app? Do you mean the android app? Or the ios app?

There are 69 notification integrations.

The service you haven’t given a name, or if they all have names, possibly the first one. I’m not reading the source to find out.

Just in case anyone comes across this post and thinks this is useful information, I’ve been doing a little research and this is what I’ve found:

notify.notify will notify one of the platforms (and only one) without a “name” attribute.

The thing is, when calling the service “notify.xxx” you are calling the notify platform and the “xxx” notification integration through it’s name.
And here comes the confusion (and I think it’s not an ideal design), the name’s attribute default value is “notify” (in any notify platform integration). So, if you don’t overwrite the default value for the “name” attribute on your notify integrations, all of them will become the service name “notify.notify”. HA doesn’t call them all, probably the “notify.notify” service data is overwritten with each definition that doesn’t have a name. I’ve gone through the code trying to find it out but I am not into Python at all, so I don’t have a clue on which is the behaviour. I can tell it is not the first/last definition, I’ve tried moving platform configurations and I always got notifications in this order: “mobile_app” > “hangouts” > “smtp”.

This means in fact, that “notify.notify” is not really a default service for notifications, but the casual result of omitting an attribute in any of your notification platform configs. The fact that installing the HA mobile app automagically creates a notify integration configuration behind the scenes that also targets “notify.notify” service name only adds more confusion.

This means that if you only define one notify platform without name, it will be reachable through the “notify.notify” service. If you only define one notify platform with a name, you won’t have a “notify.notify” service (you’ll have to call it through “notify.platform_name”). If you have the mobile_app installed, no matter what, this is the one that will get “notify.notify” notifications.

It’s very confusing indeed, and I really think it could be better explained in the documentation. I found this issue that gave the best clues, but it was closed without a conclusion:

Hope this helps anyone.

PS: I know all of this is exactly what @tom_l was saying, but I just wanted to have a broader explanation.

19 Likes

I always thought notify.notify was an odd construct.

2 Likes

@pedracca thank you for the detailed analysis.

I have two questions:
(1) if the above is correct, is using notify.notify identical to notify.mobile_app_whatever_the_name_of _the_mobile_phone and as such easier to use than calling notify.mobile_app?

(2) what if two mobile devices are logged into the mobile app, will notify.notify send a notification to both mobile devices?

Hi,

  1. At the time of writing it was, but I wouldn’t rely on it. It was undocummented and it looked like a consequence of how it was coded rather tan an intended feature.
  2. IIRC yes, wife and I were receiving the messages.

I think notify.notify should only be used as a fallback for some tests, for real world use cases I think it’s best to target a group and include there what you want to be notified. If simplicity is what you are after, you can define a group with a simple name and use that.

2 Likes

Thanks for the feedback.

Hi guys, i’m struggling with this and would like to ask for your help.

For many years notify.notify worked perfectly. Like mentioned above, it used to send a notification to all my android devices logged in with my HA account. It was super simple and perfect.

but now since few months i dont get any notifications to any of my devices. Also when i test it in the developer tools, i dont get any messages to any of my android phones/tablets.

Did something change in the recent months?

is creating a group in the config.yaml and adding all my android devices to the group, the only way to make it work now? I have many devices as i work at Samsung. several phones, tablets, plus my wife’s phones and tablets. it will be quite cumbersome to make that list and maintain it.

Any ideas/help?

Thanks a lot.