Add charging rate sensor to Tesla (#30286)

* Add charging rate sensor to Tesla

* Remove reference to bin_type
This commit is contained in:
Alan Tse 2020-01-01 15:36:14 -08:00 committed by Martin Hjelmare
parent 37d1771400
commit fc08c62a31

View File

@ -88,6 +88,16 @@ class TeslaSensor(TeslaDevice, Entity):
self.current_value = round(
convert(self.current_value, LENGTH_MILES, LENGTH_KILOMETERS), 2
)
elif self.tesla_device.type == "charging rate sensor":
self.current_value = self.tesla_device.charging_rate
self.units = units
self._attributes = {
"time_left": self.tesla_device.time_left,
"added_range": self.tesla_device.added_range,
"charge_current_request": self.tesla_device.charge_current_request,
"charger_actual_current": self.tesla_device.charger_actual_current,
"charger_voltage": self.tesla_device.charger_voltage,
}
else:
self.current_value = self.tesla_device.get_value()
self.units = units