From 0606b4a843ce6868c574ca8ef17d84365bcc71a9 Mon Sep 17 00:00:00 2001 From: Matthias Alphart Date: Mon, 21 Feb 2022 21:35:24 +0100 Subject: [PATCH] add apparent and reactive power DeviceClass (#65938) --- homeassistant/components/fronius/sensor.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/fronius/sensor.py b/homeassistant/components/fronius/sensor.py index 26747785837..a266998a9b5 100644 --- a/homeassistant/components/fronius/sensor.py +++ b/homeassistant/components/fronius/sensor.py @@ -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,