Update Zone coordinates with service or script

I would like to take the GPS coordinates from a device_tracker, my car’s smart location, and update the location of a zone so I can send a lock command if my phone device_tracker is away from it for more than 5 minutes.
Bluetooth devices near is not the solution I want.

In the homeassistant service, I can easily update the home zone location, however the general zones do not seem to have options to configure their location, just “reload”

Is there something I’m missing or do I need to go the long route and define the zone as an !include in configuration.yaml for zone: and run a script that replaces the lat/long, then call zone.reload?

You have the lat/long for your car and the phone, so it should just be using a helper/template sensor that use the math to calculate the distance between two points (lat/long).
That new sensor can then be reacted to like anything else, also if it is above 5m for some period of time.

I agree with Wally the simple solution is to create a template sensor to calculate distance between two devices:

- name: Distance between car and phone
  unique_id: 77b3d8ec-47a1-410d-97a1-264920a81f25
  device_class: distance
  unit_of_measurement: m
  state: "{{ distance('device_tracker.my_car', 'device_tracker.my_phone') }}"

If you are really set on creating dynamic zones, that is something not natively supported by home assistant. The spook integration does support it.

Thanks, this is a good alternative if what i came up with using the python script set_state.py isn’t reliable in the long run. which can modify the attributes as well. So I just set lat/long of the zone when the car device tracker changes