Use SensorDeviceClass in homewizard (#69266)

pull/67973/head^2
epenet 2022-04-04 17:41:06 +02:00 committed by GitHub
parent f04a3737a8
commit 772fc71275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 12 deletions

View File

@ -5,15 +5,13 @@ import logging
from typing import Final
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_GAS,
DEVICE_CLASS_POWER,
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
POWER_WATT,
@ -62,63 +60,63 @@ SENSORS: Final[tuple[SensorEntityDescription, ...]] = (
key="total_power_import_t1_kwh",
name="Total Power Import T1",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
SensorEntityDescription(
key="total_power_import_t2_kwh",
name="Total Power Import T2",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
SensorEntityDescription(
key="total_power_export_t1_kwh",
name="Total Power Export T1",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
SensorEntityDescription(
key="total_power_export_t2_kwh",
name="Total Power Export T2",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
SensorEntityDescription(
key="active_power_w",
name="Active Power",
native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="active_power_l1_w",
name="Active Power L1",
native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="active_power_l2_w",
name="Active Power L2",
native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="active_power_l3_w",
name="Active Power L3",
native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="total_gas_m3",
name="Total Gas",
native_unit_of_measurement=VOLUME_CUBIC_METERS,
device_class=DEVICE_CLASS_GAS,
device_class=SensorDeviceClass.GAS,
state_class=SensorStateClass.TOTAL_INCREASING,
),
)