mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add device_class to Tesla sensors (#31231)
This commit is contained in:
parent
64edf2fe33
commit
a1e1610a69
@ -37,6 +37,7 @@ class TeslaSensor(TeslaDevice, Entity):
|
|||||||
self.units = None
|
self.units = None
|
||||||
self.last_changed_time = None
|
self.last_changed_time = None
|
||||||
self.type = sensor_type
|
self.type = sensor_type
|
||||||
|
self._device_class = tesla_device.device_class
|
||||||
super().__init__(tesla_device, controller, config_entry)
|
super().__init__(tesla_device, controller, config_entry)
|
||||||
|
|
||||||
if self.type:
|
if self.type:
|
||||||
@ -59,6 +60,11 @@ class TeslaSensor(TeslaDevice, Entity):
|
|||||||
"""Return the unit_of_measurement of the device."""
|
"""Return the unit_of_measurement of the device."""
|
||||||
return self.units
|
return self.units
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_class(self):
|
||||||
|
"""Return the device_class of the device."""
|
||||||
|
return self._device_class
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update the state from the sensor."""
|
"""Update the state from the sensor."""
|
||||||
_LOGGER.debug("Updating sensor: %s", self._name)
|
_LOGGER.debug("Updating sensor: %s", self._name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user