Use UnitOfEnergy in integrations (o-z) (#84221)
This commit is contained in:
parent
3168b30535
commit
ebdf9a8658
29 changed files with 120 additions and 134 deletions
|
@ -11,7 +11,7 @@ from homeassistant.components.sensor import (
|
|||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ENERGY_KILO_WATT_HOUR, UnitOfPower
|
||||
from homeassistant.const import UnitOfEnergy, UnitOfPower
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -70,7 +70,7 @@ class SMAsensor(CoordinatorEntity, SensorEntity):
|
|||
self._config_entry_unique_id = config_entry_unique_id
|
||||
self._attr_device_info = device_info
|
||||
|
||||
if self.native_unit_of_measurement == ENERGY_KILO_WATT_HOUR:
|
||||
if self.native_unit_of_measurement == UnitOfEnergy.KILO_WATT_HOUR:
|
||||
self._attr_state_class = SensorStateClass.TOTAL_INCREASING
|
||||
self._attr_device_class = SensorDeviceClass.ENERGY
|
||||
if self.native_unit_of_measurement == UnitOfPower.WATT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue