Notification Only to the Person Triggering Zone Entry

I’ve setup an actionable notification that does exactly what I’m hoping it would do, and it triggers upon a person (and their associated device / mobile app) entering a zone. However, currently the notification is just sent to both my wife and I regardless of whose phone entered that zone.

I would like to be able to send the notification only to the person’s phone that triggered the entry into the zone.

This is what I have so far:

    - alias: 'Zone Entry'
      description: ''
      trigger:
      - platform: zone
        entity_id: person.him
        zone: zone.work
        event: enter
      - platform: zone
        entity_id: person.her
        zone: zone.work
        event: enter
      condition: []

      action:
      - service: notify.all_occupants
        data:
          title: 'You again, {{ trigger.to_state.attributes.friendly_name }}?'
          message: "Back for more?"
          data:
            actions:
              ...

So the message in the notification will say something like “You again, John Doe? Back for more?”

(1) How would I go about modifying the ‘notify’ to only send it to “notify.mobile_app_his_phone” or “notify.mobile_app_her_phone”, depending on who triggered the zone entry?

(2) I’m thinking nothing specific to the bit of code for the solution to (1) above would really be necessary to ensure both of us get the notification if we drove to work together, because both of our phones would trigger and so both should get the notification? The “mode” for this automation would have to be changed to either queued or parallel, instead of single, correct?

.
.
.

edit: as I’m looking through the “person” entity, there is a source attribute associated with each of us (e.g. source: device_tracker.iphone13)

What would work for me is to take the portion of text after the ‘dot’ in the device tracker and append it to “notify.mobile_app_” to create notify.mobile_app_iphone13

Or if there’s an easier way, even better :slight_smile:

There’s probably an even easier way… but could you not just add a trigger id to each trigger, then use an if or choose condition based on that id to either perform an action or set a variable thats then used by an action later. In this case, the variable would be device/ entity you want to send the message to.

I can’t test it right now, but I think the following should work if you want to use the source

    - alias: 'Zone Entry'
      description: ''
      trigger:
        - platform: zone
          entity_id: person.him
          zone: zone.work
          event: enter
        - platform: zone
          entity_id: person.her
          zone: zone.work
          event: enter
      condition: []
      action:
        - variables:
            target: >
              {% set x = trigger.to_state.attributes.source %}
              {{ states[x].object_id }}
        - service: notify.mobile_app_{{ target }}
          data:
            title: 'You again, {{ trigger.to_state.attributes.friendly_name }}?'
            message: "Back for more?"
            data:
              actions:
              ...

Another option would be to hard code a value for “target” into each trigger:

trigger:
   - platform: zone
     entity_id: person.him
     zone: zone.work
     event: enter
     variables:
       target: his_phone
   - platform: zone
     entity_id: person.her
     zone: zone.work
     event: enter
     variables:
       target: her_phone

i went with the first option you were showing and that fit the bill perfectly!
Seems nice and robust as it would still work if we ever replaced our phones with something else.

Tried it once today and it worked. Much appreciated!