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:
@@ -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."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user