mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Async migration device_tracker (#4406)
* Async migration device_tracker * change location stuff to async * address paulus comments * fix lint & add async discovery listener * address paulus comments v2 * fix tests * fix test_mqtt * fix test_init * fix gps_acc * fix lint * change async_update_stale to callback
This commit is contained in:
@@ -51,7 +51,10 @@ def detect_location_info():
|
||||
|
||||
|
||||
def distance(lat1, lon1, lat2, lon2):
|
||||
"""Calculate the distance in meters between two points."""
|
||||
"""Calculate the distance in meters between two points.
|
||||
|
||||
Async friendly.
|
||||
"""
|
||||
return vincenty((lat1, lon1), (lat2, lon2)) * 1000
|
||||
|
||||
|
||||
@@ -88,6 +91,8 @@ def vincenty(point1: Tuple[float, float], point2: Tuple[float, float],
|
||||
|
||||
Result in kilometers or miles between two points on the surface of a
|
||||
spheroid.
|
||||
|
||||
Async friendly.
|
||||
"""
|
||||
# short-circuit coincident points
|
||||
if point1[0] == point2[0] and point1[1] == point2[1]:
|
||||
|
||||
Reference in New Issue
Block a user