Notify person

This feature request thread brought this 5 year HA lurker out of the shadows to create an account.

Please don’t forget about this one guys. Targeting people and all their associated devices for notifications would be huge for increasing user engagement.

Here’s a workaround until this becomes a supported feature. In short, using customize.yaml you can associate notify services with each person entity. Then you can reference those in automations or scripts.

Step 1: Edit your customize.yaml file (see here for details) and list each person and their associated notification services that you’d like to use. For example:

person.john_doe:
  notify_services:
    - 'notify.mobile_app_johns_iphone'
    - 'notify.custom_notify_service_for_john'
person.jane_doe:
  notify_services:
    - 'notify.mobile_app_janes_android'

Then restart so it takes effect. (There are ways to reload this file without restarting and those methods are discussed in the docs; I won’t cover them here.)

Step 2: Utilize those new attributes in your automations & scripts. Here is an example script that will call every notify service attached to every person who is currently home:

alias: Alert everyone who is home
continue_on_error: true
sequence:
  - variables:
      notify_services: >
        {% macro flatten(nested_list) %}
          {{ (('{"items":[' ~ nested_list | string | replace('[','') | replace(']','') | replace('\'','"') ~ ']}') | from_json)['items'] }}
        {% endmacro %}
        {{ flatten(state_attr('zone.home','persons') | map('state_attr','notify_services') | list) }}
  - repeat:
      for_each: "{{ notify_services }}"
      sequence:
        - service: "{{ repeat.item }}"
          data:
            message: You are home!
mode: single

I specify continue on error in case a notify service is removed or renamed; this way all the other notifications are still sent. You will still see errors in your logs if that happens though.