Notify groups in automation actions

Questions about notifications, and specifically about notify groups, have been asked before quite frequently. The subject causes a lot of consternation among newcomers like myself. I find it frustrating that there is no clear overview in the docs, a blueprint of how the pieces work together. So I resort to Reddit and this community forum to fill the gaps, and find mostly outdated info or non-answers.
So bear with me if I have to ask a question again that was asked before.

I want to do something very simple - create a notify group with 2 devices and notify the group if the door was left open.

I found that this page in the docs is most relevant for this.
I also use this page from the companion app docs for an example of how to use text-to-speech.

In configuration.yaml I have this notify group:

  - name: all_targets
    platform: group
    services: 
      - action: mobile_app_lenovo_tb125fu
      - action: mobile_app_pixel_9_pro_xl

and I want to use it in this action:

automation "Door Open":
  trigger:
    - platform: state
      entity_id: binary_sensor.door_sensor_2
      to: "on"
  action:
    - action: notify.all_targets
      data:
        message: TTS
        data: 
          ttl: 0
          priority: high
          media_stream: alarm_stream_max
          tts_text: "Please stop leaving the door open"

This configuration loads fine, but it does not work. When I trigger the event, I get the error
automation 0: Error executing script. Service not found for call_service at pos 1: Action notify.all_targets not found

I have tried lots of variations, with/without underscore, caps, quotes around the name, rearranged how things are defined, but no luck. I removed the TTS stuff and send a simple message, I get the same error.
When I replace notify.all_targets in the action with notify.mobile_app_pixel_9_pro_xl, it works beautifully.

Folks are using this feature, so it can’t be broken. I must be missing something, or the docs are missing something. Does this work with groups or not?

And I am on HA 2025.3.3 still but looked at the release notes for 3.4 and did not see any changes related to notify groups.

The notification domain is in a bit of a state of flux at the moment. Instead of individual services/actions some notify services now create notify entities that you can use with one singe action (notify.send_message). I suspect the group notification is one of these that has been changed but it is difficult to tell as the group notification documentation is very lacking, as you noticed.

So as a test to see if it is using the new method try this from the Developer Tools → Actions page:

action: notify.send_message
data:
  entity_id: notify.all_targets  # also see if this entity exists in Developer tools -> States
  title: "This is a test of the emergency broadcast system"
  message: "This is a test. Be alert not alarmed. The world needs more lerts."

If that works we will then try to shoehorn the TTS bit into the new action.

Thanks, much appreciated.
I get this when I try to run the action: Referenced entities notify.all_targets are missing or not currently available. It is hard to tell if the group is internally recognized in any other way, the UI does not expose this, right? Going to bed now, but I will pick it up tomorrow.

Okay. Lets take a step back. Where exactly in your configuration.yaml did you put this?

Did you put it under

notify:

yes (oh I have to respond with at least 10 characters). I also have another group and an email service defined under notify.

notify:
  - name: sendsesemail
    platform: smtp
    server: email-smtp.us-east-1.amazonaws.com
    port: 587
    timeout: 30
    sender: !secret ses_sender
    encryption: starttls
    username: !secret ses_user
    password: !secret ses_password
    recipient:
      - !secret email_recipient
    sender_name: Home Assist
    
  - name: even_more_targets
    platform: group
    services: 
      - action: mobile_app_lenovo_tb125fu
      - action: mobile_app_pixel_9_pro_xl
      - action: sendsesemail
      - action: persistent_notification

  - name: all_targets
    platform: group
    services: 
      - action: mobile_app_lenovo_tb125fu
      - action: mobile_app_pixel_9_pro_xl

My SES email service works fine, so the notify section is loaded.

That all looks correct. Look for errors related to your notify group in Settings → System → Logs.

I don’t know what to say. I decided to restart HA to start with a clean slate for another look at the logs, and … it worked. Both devices played the message. I did restarts before, not just config reloads, but hadn’t done one in the past hour or so. Thanks a lot!

2 Likes

Just to be clear, for my information this was using your original config?

  action:
    - action: notify.all_targets
      data:
        message: TTS
        data: 
          ttl: 0
          priority: high
          media_stream: alarm_stream_max
          tts_text: "Please stop leaving the door open"

So it is not using the new method?

Correct. I am actuating the door sensor on my desk and it played the message on both devices.

1 Like

One more note: I was able to migrate the automation from the configuration.yaml into automations.yaml using the migrate button in the automation editor. The only thing that remains in yaml is the action, trigger and a newly added override condition are fully editable. It still works. This is the best approach, I think, as it keeps the automation clutter out of the config.

I have this redundantly named settup to keep my GUI and YAML automations in separate files:

automation: !include automations.yaml # GUI automations
automation yaml: !include automations_yaml.yaml # YAML automations

I don’t actually use the GUI except for debugging using Traces occasionally. That works for both files. I find it quicker and easier to write automations in YAML.