Use UnitOfPower in integrations [h-r] (#83815)
This commit is contained in:
parent
f24f0c2954
commit
3edb0969de
20 changed files with 77 additions and 78 deletions
|
@ -17,9 +17,8 @@ from homeassistant.const import (
|
|||
ELECTRIC_POTENTIAL_VOLT,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
ENERGY_WATT_HOUR,
|
||||
POWER_KILO_WATT,
|
||||
POWER_WATT,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfPower,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
@ -64,14 +63,14 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
|
|||
PVOutputSensorEntityDescription(
|
||||
key="normalized_output",
|
||||
name="Efficiency",
|
||||
native_unit_of_measurement=f"{ENERGY_KILO_WATT_HOUR}/{POWER_KILO_WATT}",
|
||||
native_unit_of_measurement=f"{ENERGY_KILO_WATT_HOUR}/{UnitOfPower.KILO_WATT}",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
value_fn=lambda status: status.normalized_output,
|
||||
),
|
||||
PVOutputSensorEntityDescription(
|
||||
key="power_consumption",
|
||||
name="Power consumed",
|
||||
native_unit_of_measurement=POWER_WATT,
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
value_fn=lambda status: status.power_consumption,
|
||||
|
@ -79,7 +78,7 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
|
|||
PVOutputSensorEntityDescription(
|
||||
key="power_generation",
|
||||
name="Power generated",
|
||||
native_unit_of_measurement=POWER_WATT,
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
value_fn=lambda status: status.power_generation,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue