diff --git a/homeassistant/components/blebox/sensor.py b/homeassistant/components/blebox/sensor.py index 2642bfd0139..fa11f6d6680 100644 --- a/homeassistant/components/blebox/sensor.py +++ b/homeassistant/components/blebox/sensor.py @@ -14,13 +14,13 @@ from homeassistant.const import ( CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, LIGHT_LUX, PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, UnitOfApparentPower, UnitOfElectricCurrent, UnitOfElectricPotential, UnitOfEnergy, UnitOfFrequency, UnitOfPower, + UnitOfReactivePower, UnitOfSpeed, UnitOfTemperature, ) @@ -85,7 +85,7 @@ SENSOR_TYPES = ( SensorEntityDescription( key="reactivePower", device_class=SensorDeviceClass.POWER, - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, ), SensorEntityDescription( key="activePower", diff --git a/homeassistant/components/fronius/sensor.py b/homeassistant/components/fronius/sensor.py index 31f080c1f51..c8a840b1c2c 100644 --- a/homeassistant/components/fronius/sensor.py +++ b/homeassistant/components/fronius/sensor.py @@ -14,7 +14,6 @@ from homeassistant.components.sensor import ( ) from homeassistant.const import ( PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, EntityCategory, UnitOfApparentPower, UnitOfElectricCurrent, @@ -22,6 +21,7 @@ from homeassistant.const import ( UnitOfEnergy, UnitOfFrequency, UnitOfPower, + UnitOfReactivePower, UnitOfTemperature, ) from homeassistant.core import HomeAssistant, callback @@ -381,28 +381,28 @@ METER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [ ), FroniusSensorEntityDescription( key="power_reactive_phase_1", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), FroniusSensorEntityDescription( key="power_reactive_phase_2", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), FroniusSensorEntityDescription( key="power_reactive_phase_3", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), FroniusSensorEntityDescription( key="power_reactive", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, diff --git a/homeassistant/components/goodwe/sensor.py b/homeassistant/components/goodwe/sensor.py index 795b26a0c9f..03912c9a1ec 100644 --- a/homeassistant/components/goodwe/sensor.py +++ b/homeassistant/components/goodwe/sensor.py @@ -20,7 +20,6 @@ from homeassistant.components.sensor import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, EntityCategory, UnitOfApparentPower, UnitOfElectricCurrent, @@ -28,6 +27,7 @@ from homeassistant.const import ( UnitOfEnergy, UnitOfFrequency, UnitOfPower, + UnitOfReactivePower, UnitOfTemperature, UnitOfTime, ) @@ -126,7 +126,7 @@ _DESCRIPTIONS: dict[str, GoodweSensorEntityDescription] = { key="var", device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, entity_registry_enabled_default=False, ), "C": GoodweSensorEntityDescription( diff --git a/homeassistant/components/homewizard/sensor.py b/homeassistant/components/homewizard/sensor.py index 1f77af110b0..c5cf0bc64c7 100644 --- a/homeassistant/components/homewizard/sensor.py +++ b/homeassistant/components/homewizard/sensor.py @@ -18,7 +18,6 @@ from homeassistant.components.sensor import ( from homeassistant.const import ( ATTR_VIA_DEVICE, PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, EntityCategory, Platform, UnitOfApparentPower, @@ -27,6 +26,7 @@ from homeassistant.const import ( UnitOfEnergy, UnitOfFrequency, UnitOfPower, + UnitOfReactivePower, UnitOfVolume, ) from homeassistant.core import HomeAssistant @@ -404,7 +404,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = ( ), HomeWizardSensorEntityDescription( key="active_reactive_power_var", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -415,7 +415,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = ( key="active_reactive_power_l1_var", translation_key="active_reactive_power_phase_var", translation_placeholders={"phase": "1"}, - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -426,7 +426,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = ( key="active_reactive_power_l2_var", translation_key="active_reactive_power_phase_var", translation_placeholders={"phase": "2"}, - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -437,7 +437,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = ( key="active_reactive_power_l3_var", translation_key="active_reactive_power_phase_var", translation_placeholders={"phase": "3"}, - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, device_class=SensorDeviceClass.REACTIVE_POWER, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, diff --git a/homeassistant/components/iotawatt/const.py b/homeassistant/components/iotawatt/const.py index de008388f62..278030d4f10 100644 --- a/homeassistant/components/iotawatt/const.py +++ b/homeassistant/components/iotawatt/const.py @@ -7,7 +7,6 @@ import json import httpx DOMAIN = "iotawatt" -VOLT_AMPERE_REACTIVE = "VAR" VOLT_AMPERE_REACTIVE_HOURS = "VARh" CONNECTION_ERRORS = (KeyError, json.JSONDecodeError, httpx.HTTPError) diff --git a/homeassistant/components/iotawatt/sensor.py b/homeassistant/components/iotawatt/sensor.py index c9af588c160..e0328ea9d58 100644 --- a/homeassistant/components/iotawatt/sensor.py +++ b/homeassistant/components/iotawatt/sensor.py @@ -23,6 +23,7 @@ from homeassistant.const import ( UnitOfEnergy, UnitOfFrequency, UnitOfPower, + UnitOfReactivePower, ) from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import device_registry as dr, entity_registry as er @@ -31,7 +32,7 @@ from homeassistant.helpers.typing import StateType from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.util import dt as dt_util -from .const import DOMAIN, VOLT_AMPERE_REACTIVE, VOLT_AMPERE_REACTIVE_HOURS +from .const import DOMAIN, VOLT_AMPERE_REACTIVE_HOURS from .coordinator import IotawattUpdater _LOGGER = logging.getLogger(__name__) @@ -89,7 +90,7 @@ ENTITY_DESCRIPTION_KEY_MAP: dict[str, IotaWattSensorEntityDescription] = { ), "VAR": IotaWattSensorEntityDescription( key="VAR", - native_unit_of_measurement=VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, state_class=SensorStateClass.MEASUREMENT, icon="mdi:flash", entity_registry_enabled_default=False, diff --git a/homeassistant/components/isy994/const.py b/homeassistant/components/isy994/const.py index 85ecafd6490..57b30c88075 100644 --- a/homeassistant/components/isy994/const.py +++ b/homeassistant/components/isy994/const.py @@ -23,7 +23,6 @@ from homeassistant.const import ( DEGREE, LIGHT_LUX, PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, REVOLUTIONS_PER_MINUTE, SERVICE_LOCK, SERVICE_UNLOCK, @@ -50,6 +49,7 @@ from homeassistant.const import ( UnitOfMass, UnitOfPower, UnitOfPressure, + UnitOfReactivePower, UnitOfSoundPressure, UnitOfSpeed, UnitOfTemperature, @@ -438,7 +438,7 @@ UOM_FRIENDLY_NAME = { "133": UnitOfFrequency.KILOHERTZ, "134": f"{UnitOfLength.METERS}/{UnitOfTime.SECONDS}²", "135": UnitOfApparentPower.VOLT_AMPERE, # Volt-Amp - "136": POWER_VOLT_AMPERE_REACTIVE, # VAR = Volt-Amp Reactive + "136": UnitOfReactivePower.VOLT_AMPERE_REACTIVE, # VAR = Volt-Amp Reactive "137": "", # NTP DateTime - Number of seconds since 1900 "138": UnitOfPressure.PSI, "139": DEGREE, # Degree 0-360 diff --git a/homeassistant/components/mysensors/sensor.py b/homeassistant/components/mysensors/sensor.py index 9c6c0de89e6..82e6833f664 100644 --- a/homeassistant/components/mysensors/sensor.py +++ b/homeassistant/components/mysensors/sensor.py @@ -28,6 +28,7 @@ from homeassistant.const import ( UnitOfLength, UnitOfMass, UnitOfPower, + UnitOfReactivePower, UnitOfSoundPressure, UnitOfTemperature, UnitOfVolume, @@ -195,7 +196,7 @@ SENSORS: dict[str, SensorEntityDescription] = { ), "V_VAR": SensorEntityDescription( key="V_VAR", - native_unit_of_measurement="var", + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, ), "V_VA": SensorEntityDescription( key="V_VA", diff --git a/homeassistant/components/number/const.py b/homeassistant/components/number/const.py index 6343c3a599f..ad95c9b5358 100644 --- a/homeassistant/components/number/const.py +++ b/homeassistant/components/number/const.py @@ -14,7 +14,6 @@ from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, LIGHT_LUX, PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, SIGNAL_STRENGTH_DECIBELS, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, UnitOfApparentPower, @@ -31,6 +30,7 @@ from homeassistant.const import ( UnitOfPower, UnitOfPrecipitationDepth, UnitOfPressure, + UnitOfReactivePower, UnitOfSoundPressure, UnitOfSpeed, UnitOfTemperature, @@ -468,7 +468,7 @@ DEVICE_CLASS_UNITS: dict[NumberDeviceClass, set[type[StrEnum] | str | None]] = { NumberDeviceClass.PRECIPITATION: set(UnitOfPrecipitationDepth), NumberDeviceClass.PRECIPITATION_INTENSITY: set(UnitOfVolumetricFlux), NumberDeviceClass.PRESSURE: set(UnitOfPressure), - NumberDeviceClass.REACTIVE_POWER: {POWER_VOLT_AMPERE_REACTIVE}, + NumberDeviceClass.REACTIVE_POWER: {UnitOfReactivePower.VOLT_AMPERE_REACTIVE}, NumberDeviceClass.SIGNAL_STRENGTH: { SIGNAL_STRENGTH_DECIBELS, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, diff --git a/homeassistant/components/sensor/const.py b/homeassistant/components/sensor/const.py index 5acf2ecef23..8f63e346caf 100644 --- a/homeassistant/components/sensor/const.py +++ b/homeassistant/components/sensor/const.py @@ -14,7 +14,6 @@ from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, LIGHT_LUX, PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, SIGNAL_STRENGTH_DECIBELS, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, UnitOfApparentPower, @@ -31,6 +30,7 @@ from homeassistant.const import ( UnitOfPower, UnitOfPrecipitationDepth, UnitOfPressure, + UnitOfReactivePower, UnitOfSoundPressure, UnitOfSpeed, UnitOfTemperature, @@ -563,7 +563,7 @@ DEVICE_CLASS_UNITS: dict[SensorDeviceClass, set[type[StrEnum] | str | None]] = { SensorDeviceClass.PRECIPITATION: set(UnitOfPrecipitationDepth), SensorDeviceClass.PRECIPITATION_INTENSITY: set(UnitOfVolumetricFlux), SensorDeviceClass.PRESSURE: set(UnitOfPressure), - SensorDeviceClass.REACTIVE_POWER: {POWER_VOLT_AMPERE_REACTIVE}, + SensorDeviceClass.REACTIVE_POWER: {UnitOfReactivePower.VOLT_AMPERE_REACTIVE}, SensorDeviceClass.SIGNAL_STRENGTH: { SIGNAL_STRENGTH_DECIBELS, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, diff --git a/homeassistant/components/sma/sensor.py b/homeassistant/components/sma/sensor.py index 9d580a76d9e..302c4f6b197 100644 --- a/homeassistant/components/sma/sensor.py +++ b/homeassistant/components/sma/sensor.py @@ -15,7 +15,6 @@ from homeassistant.components.sensor import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, EntityCategory, UnitOfApparentPower, UnitOfElectricCurrent, @@ -23,6 +22,7 @@ from homeassistant.const import ( UnitOfEnergy, UnitOfFrequency, UnitOfPower, + UnitOfReactivePower, UnitOfTemperature, ) from homeassistant.core import HomeAssistant @@ -204,7 +204,7 @@ SENSOR_ENTITIES: dict[str, SensorEntityDescription] = { "grid_reactive_power": SensorEntityDescription( key="grid_reactive_power", name="Grid Reactive Power", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.REACTIVE_POWER, entity_registry_enabled_default=False, @@ -212,7 +212,7 @@ SENSOR_ENTITIES: dict[str, SensorEntityDescription] = { "grid_reactive_power_l1": SensorEntityDescription( key="grid_reactive_power_l1", name="Grid Reactive Power L1", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.REACTIVE_POWER, entity_registry_enabled_default=False, @@ -220,7 +220,7 @@ SENSOR_ENTITIES: dict[str, SensorEntityDescription] = { "grid_reactive_power_l2": SensorEntityDescription( key="grid_reactive_power_l2", name="Grid Reactive Power L2", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.REACTIVE_POWER, entity_registry_enabled_default=False, @@ -228,7 +228,7 @@ SENSOR_ENTITIES: dict[str, SensorEntityDescription] = { "grid_reactive_power_l3": SensorEntityDescription( key="grid_reactive_power_l3", name="Grid Reactive Power L3", - native_unit_of_measurement=POWER_VOLT_AMPERE_REACTIVE, + native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.REACTIVE_POWER, entity_registry_enabled_default=False, diff --git a/homeassistant/components/tasmota/sensor.py b/homeassistant/components/tasmota/sensor.py index e87ff88092e..30649fa38bd 100644 --- a/homeassistant/components/tasmota/sensor.py +++ b/homeassistant/components/tasmota/sensor.py @@ -22,7 +22,6 @@ from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, LIGHT_LUX, PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, SIGNAL_STRENGTH_DECIBELS, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, EntityCategory, @@ -35,6 +34,7 @@ from homeassistant.const import ( UnitOfMass, UnitOfPower, UnitOfPressure, + UnitOfReactivePower, UnitOfSpeed, UnitOfTemperature, ) @@ -227,7 +227,7 @@ SENSOR_UNIT_MAP = { hc.PERCENTAGE: PERCENTAGE, hc.POWER_WATT: UnitOfPower.WATT, hc.PRESSURE_HPA: UnitOfPressure.HPA, - hc.REACTIVE_POWER: POWER_VOLT_AMPERE_REACTIVE, + hc.REACTIVE_POWER: UnitOfReactivePower.VOLT_AMPERE_REACTIVE, hc.SIGNAL_STRENGTH_DECIBELS: SIGNAL_STRENGTH_DECIBELS, hc.SIGNAL_STRENGTH_DECIBELS_MILLIWATT: SIGNAL_STRENGTH_DECIBELS_MILLIWATT, hc.SPEED_KILOMETERS_PER_HOUR: UnitOfSpeed.KILOMETERS_PER_HOUR, diff --git a/homeassistant/const.py b/homeassistant/const.py index 891cc0cc023..953f65efce2 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -673,8 +673,19 @@ _DEPRECATED_POWER_BTU_PER_HOUR: Final = DeprecatedConstantEnum( ) """Deprecated: please use UnitOfPower.BTU_PER_HOUR.""" + # Reactive power units -POWER_VOLT_AMPERE_REACTIVE: Final = "var" +class UnitOfReactivePower(StrEnum): + """Reactive power units.""" + + VOLT_AMPERE_REACTIVE = "var" + + +_DEPRECATED_POWER_VOLT_AMPERE_REACTIVE: Final = DeprecatedConstantEnum( + UnitOfReactivePower.VOLT_AMPERE_REACTIVE, + "2025.9", +) +"""Deprecated: please use UnitOfReactivePower.VOLT_AMPERE_REACTIVE.""" # Energy units diff --git a/tests/components/homewizard/snapshots/test_sensor.ambr b/tests/components/homewizard/snapshots/test_sensor.ambr index 63ee9312a13..dd50b098d40 100644 --- a/tests/components/homewizard/snapshots/test_sensor.ambr +++ b/tests/components/homewizard/snapshots/test_sensor.ambr @@ -712,7 +712,7 @@ 'supported_features': 0, 'translation_key': None, 'unique_id': 'aabbccddeeff_active_reactive_power_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[HWE-KWH1-entity_ids7][sensor.device_reactive_power:state] @@ -721,7 +721,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power', @@ -2632,7 +2632,7 @@ 'supported_features': 0, 'translation_key': None, 'unique_id': 'aabbccddeeff_active_reactive_power_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[HWE-KWH3-entity_ids8][sensor.device_reactive_power:state] @@ -2641,7 +2641,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power', @@ -2719,7 +2719,7 @@ 'supported_features': 0, 'translation_key': 'active_reactive_power_phase_var', 'unique_id': 'aabbccddeeff_active_reactive_power_l1_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[HWE-KWH3-entity_ids8][sensor.device_reactive_power_phase_1:state] @@ -2728,7 +2728,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power phase 1', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power_phase_1', @@ -2806,7 +2806,7 @@ 'supported_features': 0, 'translation_key': 'active_reactive_power_phase_var', 'unique_id': 'aabbccddeeff_active_reactive_power_l2_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[HWE-KWH3-entity_ids8][sensor.device_reactive_power_phase_2:state] @@ -2815,7 +2815,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power phase 2', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power_phase_2', @@ -2893,7 +2893,7 @@ 'supported_features': 0, 'translation_key': 'active_reactive_power_phase_var', 'unique_id': 'aabbccddeeff_active_reactive_power_l3_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[HWE-KWH3-entity_ids8][sensor.device_reactive_power_phase_3:state] @@ -2902,7 +2902,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power phase 3', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power_phase_3', @@ -14905,7 +14905,7 @@ 'supported_features': 0, 'translation_key': None, 'unique_id': 'aabbccddeeff_active_reactive_power_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[HWE-SKT-21-entity_ids3][sensor.device_reactive_power:state] @@ -14914,7 +14914,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power', @@ -16200,7 +16200,7 @@ 'supported_features': 0, 'translation_key': None, 'unique_id': 'aabbccddeeff_active_reactive_power_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[SDM230-entity_ids5][sensor.device_reactive_power:state] @@ -16209,7 +16209,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power', @@ -18120,7 +18120,7 @@ 'supported_features': 0, 'translation_key': None, 'unique_id': 'aabbccddeeff_active_reactive_power_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[SDM630-entity_ids6][sensor.device_reactive_power:state] @@ -18129,7 +18129,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power', @@ -18207,7 +18207,7 @@ 'supported_features': 0, 'translation_key': 'active_reactive_power_phase_var', 'unique_id': 'aabbccddeeff_active_reactive_power_l1_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[SDM630-entity_ids6][sensor.device_reactive_power_phase_1:state] @@ -18216,7 +18216,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power phase 1', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power_phase_1', @@ -18294,7 +18294,7 @@ 'supported_features': 0, 'translation_key': 'active_reactive_power_phase_var', 'unique_id': 'aabbccddeeff_active_reactive_power_l2_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[SDM630-entity_ids6][sensor.device_reactive_power_phase_2:state] @@ -18303,7 +18303,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power phase 2', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power_phase_2', @@ -18381,7 +18381,7 @@ 'supported_features': 0, 'translation_key': 'active_reactive_power_phase_var', 'unique_id': 'aabbccddeeff_active_reactive_power_l3_var', - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }) # --- # name: test_sensors[SDM630-entity_ids6][sensor.device_reactive_power_phase_3:state] @@ -18390,7 +18390,7 @@ 'device_class': 'reactive_power', 'friendly_name': 'Device Reactive power phase 3', 'state_class': , - 'unit_of_measurement': 'var', + 'unit_of_measurement': , }), 'context': , 'entity_id': 'sensor.device_reactive_power_phase_3', diff --git a/tests/components/sensor/common.py b/tests/components/sensor/common.py index 53a93b73da3..458009b2690 100644 --- a/tests/components/sensor/common.py +++ b/tests/components/sensor/common.py @@ -10,11 +10,11 @@ from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, LIGHT_LUX, PERCENTAGE, - POWER_VOLT_AMPERE_REACTIVE, SIGNAL_STRENGTH_DECIBELS, UnitOfApparentPower, UnitOfFrequency, UnitOfPressure, + UnitOfReactivePower, UnitOfVolume, ) @@ -44,7 +44,7 @@ UNITS_OF_MEASUREMENT = { SensorDeviceClass.ENERGY: "kWh", # energy (Wh/kWh/MWh) SensorDeviceClass.FREQUENCY: UnitOfFrequency.GIGAHERTZ, # energy (Hz/kHz/MHz/GHz) SensorDeviceClass.POWER_FACTOR: PERCENTAGE, # power factor (no unit, min: -1.0, max: 1.0) - SensorDeviceClass.REACTIVE_POWER: POWER_VOLT_AMPERE_REACTIVE, # reactive power (var) + SensorDeviceClass.REACTIVE_POWER: UnitOfReactivePower.VOLT_AMPERE_REACTIVE, # reactive power (var) SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, # µg/m³ of vocs SensorDeviceClass.VOLTAGE: "V", # voltage (V) SensorDeviceClass.GAS: UnitOfVolume.CUBIC_METERS, # gas (m³)