Extend UnitOfReactivePower with 'kvar' (#142558)

This commit is contained in:
skrynklarn 2025-04-09 21:22:02 +02:00 committed by GitHub
parent 76015740f8
commit 1b66278a68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -323,7 +323,7 @@ class NumberDeviceClass(StrEnum):
REACTIVE_POWER = "reactive_power" REACTIVE_POWER = "reactive_power"
"""Reactive power. """Reactive power.
Unit of measurement: `var` Unit of measurement: `var`, `kvar`
""" """
SIGNAL_STRENGTH = "signal_strength" SIGNAL_STRENGTH = "signal_strength"
@ -497,7 +497,7 @@ DEVICE_CLASS_UNITS: dict[NumberDeviceClass, set[type[StrEnum] | str | None]] = {
NumberDeviceClass.PRECIPITATION: set(UnitOfPrecipitationDepth), NumberDeviceClass.PRECIPITATION: set(UnitOfPrecipitationDepth),
NumberDeviceClass.PRECIPITATION_INTENSITY: set(UnitOfVolumetricFlux), NumberDeviceClass.PRECIPITATION_INTENSITY: set(UnitOfVolumetricFlux),
NumberDeviceClass.PRESSURE: set(UnitOfPressure), NumberDeviceClass.PRESSURE: set(UnitOfPressure),
NumberDeviceClass.REACTIVE_POWER: {UnitOfReactivePower.VOLT_AMPERE_REACTIVE}, NumberDeviceClass.REACTIVE_POWER: set(UnitOfReactivePower),
NumberDeviceClass.SIGNAL_STRENGTH: { NumberDeviceClass.SIGNAL_STRENGTH: {
SIGNAL_STRENGTH_DECIBELS, SIGNAL_STRENGTH_DECIBELS,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT, SIGNAL_STRENGTH_DECIBELS_MILLIWATT,

View File

@ -352,7 +352,7 @@ class SensorDeviceClass(StrEnum):
REACTIVE_POWER = "reactive_power" REACTIVE_POWER = "reactive_power"
"""Reactive power. """Reactive power.
Unit of measurement: `var` Unit of measurement: `var`, `kvar`
""" """
SIGNAL_STRENGTH = "signal_strength" SIGNAL_STRENGTH = "signal_strength"
@ -596,7 +596,7 @@ DEVICE_CLASS_UNITS: dict[SensorDeviceClass, set[type[StrEnum] | str | None]] = {
SensorDeviceClass.PRECIPITATION: set(UnitOfPrecipitationDepth), SensorDeviceClass.PRECIPITATION: set(UnitOfPrecipitationDepth),
SensorDeviceClass.PRECIPITATION_INTENSITY: set(UnitOfVolumetricFlux), SensorDeviceClass.PRECIPITATION_INTENSITY: set(UnitOfVolumetricFlux),
SensorDeviceClass.PRESSURE: set(UnitOfPressure), SensorDeviceClass.PRESSURE: set(UnitOfPressure),
SensorDeviceClass.REACTIVE_POWER: {UnitOfReactivePower.VOLT_AMPERE_REACTIVE}, SensorDeviceClass.REACTIVE_POWER: set(UnitOfReactivePower),
SensorDeviceClass.SIGNAL_STRENGTH: { SensorDeviceClass.SIGNAL_STRENGTH: {
SIGNAL_STRENGTH_DECIBELS, SIGNAL_STRENGTH_DECIBELS,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT, SIGNAL_STRENGTH_DECIBELS_MILLIWATT,

View File

@ -603,6 +603,7 @@ class UnitOfReactivePower(StrEnum):
"""Reactive power units.""" """Reactive power units."""
VOLT_AMPERE_REACTIVE = "var" VOLT_AMPERE_REACTIVE = "var"
KILO_VOLT_AMPERE_REACTIVE = "kvar"
_DEPRECATED_POWER_VOLT_AMPERE_REACTIVE: Final = DeprecatedConstantEnum( _DEPRECATED_POWER_VOLT_AMPERE_REACTIVE: Final = DeprecatedConstantEnum(