Notifications on iOS

Hi all!

This might be the shortest topic in the HA community but thought I´ll give it a try.

My problem:
I´ve created an automation that triggers when me or my girlfriend arrive at various places (zones defined in HA) with a little greeting notification. So far so good. My issue is that i dont want to have the automations twice in configuration.yaml but instead running the notification as a variable so only the person that enters the zone gets the notification.

So the thing I´m looking for is something like this:
notify.mobile_app_{{ trigger.zone.device_id }}

So this might be the shortest topic as this might not be possible to achive :slight_smile:

Thanks in advance!

You could try if statements in a template format. Here are some examples.

Thanks, might be worth looking into. Just so you can get a better understanding of what I´m trying to achive this is my automation (re-written a little):
automation test:

  • alias: “TEST: Welcome”
    trigger:
    • platform: zone
      entity_id:
      • person.me
      • person.her
        zone:
      • location1
      • location2
      • location3
        event: enter
        condition:
    • condition: state
      entity_id:
      • sensor.me_iphone_ssid
      • sensor.her_iphone_ssid
        state:
      • wifi1
      • wifi2
      • wifi3
        for: “00:01:00”
        action:
    • service: notify.mobile_app_{{ trigger.to_state.device_id }}s_iphone
      data:
      title: “test title”
      message: “welcome”

All input is welcomed @Vasco :slight_smile:

Maybe you can share the actual yaml code.

The conditions must be contained in a OR clause, so
OR
Iphone 1
OR
iphone 2
AND
OR
location 1,
OR
Location 2,
OR
Location 3

That way you tell the automation

If one of my phones enters these locations, THEN, action is to call service notify. But you want this in a template, because you want the phone that actually moved into a zone to be notified not both.

So if iphone 1, zone 1 or 2 or 3, than say welcome.

Kind of a raw sketch. Not near computer anywhere soon, have to do all by phone now. Makes it more complicated.

The only thing i stripped from the yaml is the real names of all the stuff to make it more generic but I can see that the indentation is not 100% from my copy paste :slight_smile:

The ideal result would be, like you say, have it an a template so that i dont have to write additional AND/OR for when adding new places and new networks but instead just keep adding to the bulletlist.

Haven´t been working much on this lately but solved it by using this in the notify part:
trigger:
.....
condition:
.....
action:
  - service: notify.mobile_app_{{trigger.entity_id | regex_replace(find='device_tracker.', replace='') }}

That did the trick :slight_smile: