I have the following automation which it works but it triggers if I enter the myHome zone but when I am leaving also.
I think I have to use the proximity integration but although I read the instructions and some examples I am not sure I how it works.
the automation right now is
- id: Open Garage Door when close to home
alias: Open Garage Door when close to home
trigger:
platform: state
entity_id: device_tracker.sm_g955f
to: 'myHome'
condition:
condition: state
entity_id: binary_sensor.garage_door_sensor
state: 'off'
action:
- service: switch.toggle
data:
entity_id: switch.sonoff_100082f95b
So I have to add to the confgiguration yaml
proximity:
myHome:
devices:
device_tracker.sm_g955f
tolerance: 50
unit_of_measurement: km
and change the automation to something like this?
- id: Open Garage Door when close to home
alias: Open Garage Door when close to home
trigger:
- platform: numeric_state
entity_id: proximity.myHome
below: 0.3 # I need 300 meters from Home Is that ok?
condition:
condition: and
conditions:
- condition: template
value_template: '{{ states.proximity.myHome.attributes.dir_of_travel == "towards" }}'
- condition: state
entity_id: binary_sensor.garage_door_sensor
state: 'off'
action:
- service: switch.toggle
data:
entity_id: switch.sonoff_100082f95b
I have set up the following zones. Given the fact that in the near future I will add a few more zones
will it be wise to exclude them or not?
** The critical parts of the code like value_template I did find them from other members