Notify multiple receiptents

I am having some automations where I have notified only myself. My wife would also like to receive the notifications, and I have made that work like this:

def skal (self, entity, attribute, old, new, kwargs):
    if self.get_state("input_boolean.alarm_mode") == "on":
        self.notify("Vindue eller dør åben!", name = "telegram_morten")
        self.notify("Vindue eller dør åben!", name = "telegram_trine") 

But I think it is rather ineffecient to have two lines doing basically the same.
I tried to make a:

self.notify("Vindue eller dør åben!", name = ("telegram_trine", "telegram_morten") 
self.notify("Vindue eller dør åben!", name = (["telegram_trine", "telegram_morten"])

But none of those works.

I also tried to make a workaround via apps.yaml:

Alarm:
    module: alarm
    class: alarm
    telegramID:
        -telegram_morten
        -telegram_trine

And then in the app

self.notify("Vindue eller dør åben!", name = self.args["telegramID"])

Also no luck.

thats because it probably isnt possible in HA
you can try without a name, but if you have other notify components in HA it will be send to all notify components.

if you use notify on several places you can create a general function that sends notify to both.

If I change it to just this:

def skal (self, entity, attribute, old, new, kwargs):
    if self.get_state("input_boolean.alarm_mode") == "on":
        self.notify("Vindue eller dør åben!", name = "telegram_morten")

Then I get no nofitication at all. It is okay if the message was sent to all nofify components :slight_smile:

How about creating a group for them?
https://www.home-assistant.io/components/notify.group/

1 Like

That works very well, thanks!