Migrate power units to an enum (#81026)

pull/81035/head
epenet 2022-10-26 17:28:23 +02:00 committed by GitHub
parent 3eb574edca
commit 8645e47b07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -478,10 +478,22 @@ ATTR_PERSONS: Final = "persons"
# Apparent power units
POWER_VOLT_AMPERE: Final = "VA"
# Power units
class UnitOfPower(StrEnum):
"""Power units."""
WATT = "W"
KILO_WATT = "kW"
BTU_PER_HOUR = "BTU/h"
POWER_WATT: Final = "W"
"""Deprecated: please use UnitOfPower.WATT."""
POWER_KILO_WATT: Final = "kW"
"""Deprecated: please use UnitOfPower.KILO_WATT."""
POWER_BTU_PER_HOUR: Final = "BTU/h"
"""Deprecated: please use UnitOfPower.BTU_PER_HOUR."""
# Reactive power units
POWER_VOLT_AMPERE_REACTIVE: Final = "var"