In my calendar, I set the location of (some) appointments to either a lat/lon combination, or to a zone (like: zone.shop). I have a script that calculates the distance between that location and my location, to see if the car's heater should be turned on or not, depending on the distance to travel.
How can I call that script when running the automation, and use its output as a condition? Like: If the distance is more than 40 miles, turn on the air conditioning 1 hour before the appointment, else 15 minutes.