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
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:
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
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: