Use UnitOfPower in integrations [h-r] (#83815)

This commit is contained in:
epenet 2022-12-12 11:41:58 +01:00 committed by GitHub
parent f24f0c2954
commit 3edb0969de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 77 additions and 78 deletions

View file

@ -12,9 +12,9 @@ from homeassistant.const import (
ENERGY_KILO_WATT_HOUR,
ENERGY_WATT_HOUR,
PERCENTAGE,
POWER_WATT,
PRESSURE_BAR,
TEMP_CELSIUS,
UnitOfPower,
UnitOfVolume,
)
from homeassistant.core import HomeAssistant
@ -108,14 +108,14 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key="electricity_consumed",
name="Electricity consumed",
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="electricity_produced",
name="Electricity produced",
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False,
@ -166,14 +166,14 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key="electricity_consumed_off_peak_point",
name="Electricity consumed off peak point",
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="electricity_consumed_peak_point",
name="Electricity consumed peak point",
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
@ -194,14 +194,14 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key="electricity_produced_off_peak_point",
name="Electricity produced off peak point",
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="electricity_produced_peak_point",
name="Electricity produced peak point",
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
@ -236,7 +236,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key="net_electricity_point",
name="Net electricity point",
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),