Use UnitOfEnergy in integrations (a-n) (#84220)

This commit is contained in:
epenet 2022-12-19 11:06:00 +01:00 committed by GitHub
parent ebdf9a8658
commit 0dd20fb309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 191 additions and 202 deletions

View file

@ -14,9 +14,9 @@ from homeassistant.components.sensor import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
TEMP_CELSIUS,
UnitOfEnergy,
UnitOfFrequency,
UnitOfPower,
)
@ -98,7 +98,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
name="Cool energy consumption",
icon="mdi:snowflake",
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
entity_registry_enabled_default=False,
value_func=lambda device: round(device.last_hour_cool_energy_consumption, 2),
),
@ -107,7 +107,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
name="Heat energy consumption",
icon="mdi:fire",
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
entity_registry_enabled_default=False,
value_func=lambda device: round(device.last_hour_heat_energy_consumption, 2),
),
@ -116,7 +116,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
name="Energy consumption",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_func=lambda device: round(device.today_energy_consumption, 2),
),
DaikinSensorEntityDescription(
@ -134,7 +134,7 @@ SENSOR_TYPES: tuple[DaikinSensorEntityDescription, ...] = (
name="Compressor energy consumption",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
entity_registry_enabled_default=False,
value_func=lambda device: round(device.today_total_energy_consumption, 2),
),