1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Add reactive energy device class and units (#143941)

This commit is contained in:
alorente
2025-05-15 13:05:46 +02:00
committed by GitHub
parent 66ecc4d69d
commit 1d47dc41c9
19 changed files with 96 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ from homeassistant.const import (
UnitOfMass,
UnitOfPower,
UnitOfPressure,
UnitOfReactiveEnergy,
UnitOfSpeed,
UnitOfTemperature,
UnitOfTime,
@@ -429,6 +430,17 @@ class PressureConverter(BaseUnitConverter):
}
class ReactiveEnergyConverter(BaseUnitConverter):
"""Utility to convert reactive energy values."""
UNIT_CLASS = "energy"
_UNIT_CONVERSION: dict[str | None, float] = {
UnitOfReactiveEnergy.VOLT_AMPERE_REACTIVE_HOUR: 1,
UnitOfReactiveEnergy.KILO_VOLT_AMPERE_REACTIVE_HOUR: 1 / 1e3,
}
VALID_UNITS = set(UnitOfReactiveEnergy)
class SpeedConverter(BaseUnitConverter):
"""Utility to convert speed values."""