leeyuentuen / polestar_api

Polestar Api - Home Assistant Component
MIT License
112 stars 18 forks source link

Fix for some conversions to non-metric #77

Closed carrel-gr closed 5 months ago

carrel-gr commented 5 months ago

Fixes #76

dgomes commented 5 months ago

This conversion must stop... it is handle by HA core, this is just duplication of efforts and is error prone.

Only one of the properties should be read and the other completely ignored

carrel-gr commented 5 months ago

How does one properly use the core to convert between metric and non-metric? Odometer seems to be read as meters, most other distances are kilometers, and the efficiency is in kWh/100km which there doesn't seem to be a native unit for. I'll happily try to help convert things to "the right way". I'll look for some examples. Can you point me at one?

This conversion must stop... it is handle by HA core, this is just duplication of efforts and is error prone.

Only one of the properties should be read and the other completely ignored

dgomes commented 5 months ago

Similar to temperature:

https://developers.home-assistant.io/blog/2021/08/12/sensor_temperature_conversion

Properties must be set:

native_value , native_unit_of_measurement and device_class SensorDeviceClass.DISTANCE

leeyuentuen commented 5 months ago

no worries, i've already something ready for this. I'll commit them soon

leeyuentuen commented 5 months ago

i still need to test, but this should fix the non-metric issue