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
|
@ -9,12 +9,7 @@ from homeassistant.components.sensor import (
|
|||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
UnitOfPower,
|
||||
UnitOfVolume,
|
||||
)
|
||||
from homeassistant.const import CONF_DEVICE, UnitOfEnergy, UnitOfPower, UnitOfVolume
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -136,7 +131,7 @@ class CurrentPowerSensor(YoulessBaseSensor):
|
|||
class DeliveryMeterSensor(YoulessBaseSensor):
|
||||
"""The Youless delivery meter value sensor."""
|
||||
|
||||
_attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
|
||||
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
|
||||
_attr_device_class = SensorDeviceClass.ENERGY
|
||||
_attr_state_class = SensorStateClass.TOTAL_INCREASING
|
||||
|
||||
|
@ -162,7 +157,7 @@ class DeliveryMeterSensor(YoulessBaseSensor):
|
|||
class EnergyMeterSensor(YoulessBaseSensor):
|
||||
"""The Youless low meter value sensor."""
|
||||
|
||||
_attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
|
||||
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
|
||||
_attr_device_class = SensorDeviceClass.ENERGY
|
||||
_attr_state_class = SensorStateClass.TOTAL_INCREASING
|
||||
|
||||
|
@ -194,7 +189,7 @@ class EnergyMeterSensor(YoulessBaseSensor):
|
|||
class ExtraMeterSensor(YoulessBaseSensor):
|
||||
"""The Youless extra meter value sensor (s0)."""
|
||||
|
||||
_attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR
|
||||
_attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
|
||||
_attr_device_class = SensorDeviceClass.ENERGY
|
||||
_attr_state_class = SensorStateClass.TOTAL_INCREASING
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue