I setup this integration:
proximity:
casa:
zone: home
devices:
- device_tracker.sm_s908b
- device_tracker.life360_fha
tolerance: 200
unit_of_measurement: m
And then i created this automation to announce when and which of the two device_trackers is near zone Home. Actually it works but it announce always only one of the device. I would like to understand how to distinguish which of the two device_trackers is closest to the zone inserted in the automation.
- id:A 500 metri da casa
alias: A 500 metri da casa
mode: single
trigger:
- platform: numeric_state
entity_id:
- proximity.casa
below: 500
condition:
condition: template
value_template: '{{ trigger.to_state.attributes.dir_of_travel == "towards" }}'
action:
- service: notify.alexa_media
data_template:
target:
- media_player.echo_plus
data:
type: tts
message: '{{trigger.to_state.object_id[:-5] | capitalize}} è a 500 metri da
casa e sta tornando!'
Maybe using some variables?
Can someone help me in this?