add apparent and reactive power DeviceClass (#65938)

This commit is contained in:
Matthias Alphart 2022-02-21 21:35:24 +01:00 committed by GitHub
parent d49029e9fc
commit 0606b4a843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -24,6 +24,7 @@ from homeassistant.const import (
FREQUENCY_HERTZ,
PERCENTAGE,
POWER_VOLT_AMPERE,
POWER_VOLT_AMPERE_REACTIVE,
POWER_WATT,
TEMP_CELSIUS,
)
@ -52,7 +53,6 @@ _LOGGER: Final = logging.getLogger(__name__)
ELECTRIC_CHARGE_AMPERE_HOURS: Final = "Ah"
ENERGY_VOLT_AMPERE_REACTIVE_HOUR: Final = "varh"
POWER_VOLT_AMPERE_REACTIVE: Final = "var"
PLATFORM_SCHEMA = vol.All(
PLATFORM_SCHEMA.extend(
@ -338,6 +338,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [
key="power_apparent_phase_1",
name="Power apparent phase 1",
native_unit_of_measurement=POWER_VOLT_AMPERE,
device_class=SensorDeviceClass.APPARENT_POWER,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash-outline",
entity_registry_enabled_default=False,
@ -346,6 +347,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [
key="power_apparent_phase_2",
name="Power apparent phase 2",
native_unit_of_measurement=POWER_VOLT_AMPERE,
device_class=SensorDeviceClass.APPARENT_POWER,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash-outline",
entity_registry_enabled_default=False,
@ -354,6 +356,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [
key="power_apparent_phase_3",
name="Power apparent phase 3",
native_unit_of_measurement=POWER_VOLT_AMPERE,
device_class=SensorDeviceClass.APPARENT_POWER,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash-outline",
entity_registry_enabled_default=False,
@ -362,6 +365,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [
key="power_apparent",
name="Power apparent",
native_unit_of_measurement=POWER_VOLT_AMPERE,
device_class=SensorDeviceClass.APPARENT_POWER,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash-outline",
entity_registry_enabled_default=False,
@ -397,6 +401,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [
key="power_reactive_phase_1",
name="Power reactive phase 1",
native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE,
device_class=SensorDeviceClass.REACTIVE_POWER,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash-outline",
entity_registry_enabled_default=False,
@ -405,6 +410,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [
key="power_reactive_phase_2",
name="Power reactive phase 2",
native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE,
device_class=SensorDeviceClass.REACTIVE_POWER,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash-outline",
entity_registry_enabled_default=False,
@ -413,6 +419,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [
key="power_reactive_phase_3",
name="Power reactive phase 3",
native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE,
device_class=SensorDeviceClass.REACTIVE_POWER,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash-outline",
entity_registry_enabled_default=False,
@ -421,6 +428,7 @@ METER_ENTITY_DESCRIPTIONS: list[SensorEntityDescription] = [
key="power_reactive",
name="Power reactive",
native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE,
device_class=SensorDeviceClass.REACTIVE_POWER,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash-outline",
entity_registry_enabled_default=False,