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