From 8645e47b07fd2ab3386012fe492fa9ab690830b5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 26 Oct 2022 17:28:23 +0200 Subject: [PATCH] Migrate power units to an enum (#81026) --- homeassistant/const.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/homeassistant/const.py b/homeassistant/const.py index 766d78e7ac6..7601dd05dd4 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -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"