I’m trying to improve upon my entered_zone/leave_zone automatons. Today I’m sending a notification to a group whenever someone enters or leaves a zone. Now, I would like to send the notifications only to the people that didn’t trigger the event.
Example
Current solution:
Wife arrives at work, now both me and her get the notification
I arrives at home, now both me and her get the notification
Wanted solution:
Wife arrives to work, only me get the notification
I come home, only wife get the notification
In my automation I have
action:
- service: notify.family
data_template: "{{ trigger.to_state.attributes.friendly_name }}" has arrived to {{ trigger.to_state.state }}"
What I need (what I think I need) is to exchange the service call depending on the trigger, but this is quite hard to test :-/
I would say you need to use the choose option.
If you have choose state if you state !== trigger.to_state.state then send message to you.
Then make another with her state !== trigger.to_state.state then send message to her.
So if you are not the one triggering the automation then you should get notified. But if you are the one who triggered the automation then your state should be the same as the trigger.to_state.state and thus you should not be notified