Adding additional switches and sensors for Tesla (#12241)

* Adding switch for maxrange charging and sensors for odometer and range

* Fixing style errors
This commit is contained in:
Alan Tse 2018-03-04 02:35:38 -08:00 committed by Pascal Vizeli
parent ae257651bf
commit 36e9f523d1
3 changed files with 60 additions and 14 deletions

View file

@ -78,6 +78,14 @@ class TeslaSensor(TeslaDevice, Entity):
self._unit = TEMP_FAHRENHEIT
else:
self._unit = TEMP_CELSIUS
elif (self.tesla_device.bin_type == 0xA or
self.tesla_device.bin_type == 0xB):
self.current_value = self.tesla_device.get_value()
tesla_dist_unit = self.tesla_device.measurement
if tesla_dist_unit == 'LENGTH_MILES':
self._unit = LENGTH_MILES
else:
self._unit = LENGTH_KILOMETERS
else:
self.current_value = self.tesla_device.get_value()
if self.tesla_device.bin_type == 0x5: