Okay,
I have set up and used distance for quite a while but I’ve always found the set up to be less than satisfying.
With the template editor I enter : -
{{ states.device_tracker.life360_muttley }}
{{ states.device_tracker.life360_muttley.attributes }}
{{ '%.3f' | format(distance(states.device_tracker.life360_muttley)) }}
And in response I get : -
<template state device_tracker.life360_muttley=home; source_type=gps, latitude=x.xxxxxx, longitude=x.xxxxxx, gps_accuracy=15, battery=58, address=Home, at_loc_since=2020-01-09T13:19:18+00:00, battery_charging=False, driving=False, last_seen=2020-01-10T01:41:09+00:00, moving=False, place=Home, raw_speed=0.87847424, speed=3, wifi_on=True, friendly_name=life360 muttley @ 2020-01-09T13:19:28.437379+00:00>
{'source_type': 'gps', 'latitude': x.xxxxxx, 'longitude': x.xxxxxx, 'gps_accuracy': 15, 'battery': 58, 'address': 'Home', 'at_loc_since': datetime.datetime(2020, 1, 9, 13, 19, 18, tzinfo=<UTC>), 'battery_charging': False, 'driving': False, 'last_seen': datetime.datetime(2020, 1, 10, 1, 41, 9, tzinfo=<UTC>), 'moving': False, 'place': 'Home', 'raw_speed': 0.87847424, 'speed': 3, 'wifi_on': True, 'friendly_name': 'life360 muttley'}
0.006
So given the lack of a clear attribute named ‘distance’, how come the 3rd entry even works ?
And as this is not the best way to call such (as the templating documents state) how should it be called ?