Over six months ago, my meters-to-miles value_template quit working. It was fine than all of the sudden it wasn’t. I’ve confirmed the sensor name, and the syntax of the value_template. What has changed?
Yes. ‘sensor.russ_iphone_distance_2’ is my iphone and is changing distance as I walk.
It displays and distance changes fine in the Lovelace UI, but in meters rather than miles. If I paste the template code into the Template Editor, it displays the miles correctly.
So it was a copy-paste error; the real version is vertically aligned but the posted version lost some indentation in the copy-paste operation. Anything else different between the posted and real version?
Also, do you have any other Template Sensors and are they working correctly?
Then the template is fine but the Template Sensor’s configuration is suspect. What is the current state value of sensor.distance?