Notify person

I would like the option to notify a person, just like the device trackers it would be nice to assign the notify.device to a person.

Then if you change the notification service you do not need to change all the automations and besides this it makes managing persons/users a lot easier.

This is an amazing idea as I’ve been through the exercise quite a few times already.

I do this by creating a group notification and add/remove notifiers there. My automations only use those groups and never the dedicated notifiers. My most used notifiers are ‘notify.all’ and ‘notify.admin’.

5 Likes

@metbril The notify group option is what I use at the moment but you need to restart Home-Assistant to use them/update them. I think it would be more organised to add them to a person.

How do you determine the right value for target? For example they list “macbook” in their example but if I want to notify a specific device like my iPhone is it just “mobile_app_xxxxs_iphone” (from “notify.mobile_app_xxxxs_iphone”) or something different?

I had the exact same idea…
then on the person menu we could choose which device that person will use to receive notifications.

1 Like

I was looking for something similar, i wanted to notify only the users that are in my group list that are home.
for example when the dishwasher, washingmachine etc is done with it’s program.

So i created this little python script.
It’s my first python script for home assistant and might need some error checking fine tuning but for now it works for me.

image

notify_home.py

new_group = data.get("group_persons", "")
new_topic = data.get("topic","")
new_message = data.get("message","")

entity = hass.states.get(new_group)
for entity_id in hass.states.get(new_group).attributes['entity_id']:
    state = hass.states.get(entity_id)
    if state.state == 'home':
        #Get source attribute
        source = hass.states.get(entity_id).attributes['source']
        #Replace text in string attributes
        newsource = source.replace('device_tracker.', 'mobile_app_')
        logger.info(newsource)
        #Send message to all mobile app users
        hass.services.call('notify', newsource, {
        "title": new_topic,
        "message": new_message})  
2 Likes

Would indeed be cool if the devices of one person are automatically added to some (meta) group. This might require that notifiers (like html5 push notify) have a person assigned to them.

I think this is not possible at the moment, right?

1 Like

A conceptual way to do this, like the initial “group” answer is publisher/subscriber/topic.

IE, you have an MQTT topic: /home/broadcast/notifications

You add that as the service you call.

Person 1 enters home
Subscribe all devices to MQTT topic /home/broadcast/notifications

On new message to topic, push notify.

Person 1 leaves home
Unsubscribe.

Its a bit tricky to automatically say “all people, add all devices on entering home” and not have it be annoying. Needs a concept of preferred notification means.

I just came up with the same idea of this FR because I face the issue with someone changing of device.
+1

+1
This sounds like a quite logical next step for improving the person integration!
@houtknots I think, you could tag the person integration in your feature request as well :slight_smile:

4 Likes

Hi, @frenck I really don’t want to interrupt you with anything you do, but can you take a look at this feature request. We all think this will be a great feature.

+1
I have changed my mobile phone recently and I was surprised that most of my automation simply handled over easily as I had them assigned to people instead of individual device trackers, so reassigning the device to a person simply solved most of it. I mean most as this notify system doesn’t support “person”.

+1 here too. This would be a great and natural feature. Today, there does not seem to be a reliable and local way (a tenet of HA) to notify an individual user that will not eventually need maintenance due to device changes, etc.

With the new helpers there is no longer the need to restart.

@metrbil, how did you do this?

I think you mean how to create a helper group? That’s easy, I think. Go to Settings > Helpers, create a new group and add one or more notifiers. Then reload the groups from the developer tools.

Dont really see a way to do that… As far as I’ve tested none of the helper group types work with notifiers. Did you get it to work?

Sorry for the confusion.

Notify groups (groups of device notifiers) should be created like this:

notify:
  # List all notifiers for a person
  # Creates a notifier 'notify.person_1'
  - name: Person 1
    platform: group
    services:
      - service: mobile_app_person_1  # refers to 'notify.mobile_app_person_1'
      - service: pushover  # refers to 'notify.pushover'
1 Like

If you just rename your device to the old device’s name your automations will just work like they did before. Example: my device is named “Samsung van Jaap” under person you choose “device to track: Samsung van Jaap” in automations you choose notify mobile app Samsung van Jaap. Next time you get a new device just remove the old one and add the new one with the same name.