codingcyclist / ha_strava

Pipe your Activity Data from Strava directly into Home Assistant
MIT License
76 stars 29 forks source link

Remove distance unit of measurement from sensors #5

Open BertrumUK opened 4 years ago

BertrumUK commented 4 years ago

I live in the UK where we use Miles but Strava provides our distances in KM. The distance sensor 0.3 / 1.3 etc, provided by this integration, adds km to the end of this sensor therefore a templates sensor to convert it to miles is not possible. Looking at your code it will either return Miles or KM depending on if HA is set for metric or Imperial - is there a way to add an option on the integration to set metric or Imperial ?

{{ states.sensor.strava_0_3.state | float 0.621371 | round(2) }} {{ states.sensor.strava_1_3.state | float 0.621371 | round(2) }}

error

Can I suggest that the unit of measurement on this sensor is removed so that its value can be manipulated with a template sensor or a sensor to provide both the distance in Miles & KM or provide a why to set it in the integration ?

distance

codingcyclist commented 3 years ago

@BertrumUK Good idea to remove the UOM from the sensor value. I hope I get to that soon, but I'm pretty busy at work right now, so I can't promise anything :-/

kkemseke commented 3 years ago

I would like to request the same for the YTD distance ridden. This way I can have a gauge with my yearly target distance... unless there is an easy way to parse the value to a number in yaml.