Fixing odometer to display km (#13427)

This commit is contained in:
Alan Tse 2018-03-25 00:46:47 -07:00 committed by Paulus Schoutsen
parent 2d2e8034d6
commit 3a765692e7

View File

@ -86,6 +86,8 @@ class TeslaSensor(TeslaDevice, Entity):
self._unit = LENGTH_MILES
else:
self._unit = LENGTH_KILOMETERS
self.current_value /= 0.621371
self.current_value = round(self.current_value, 2)
else:
self.current_value = self.tesla_device.get_value()
if self.tesla_device.bin_type == 0x5:
@ -95,3 +97,5 @@ class TeslaSensor(TeslaDevice, Entity):
self._unit = LENGTH_MILES
else:
self._unit = LENGTH_KILOMETERS
self.current_value /= 0.621371
self.current_value = round(self.current_value, 2)