From e0d94d799a85bab3b111e36cef4fe81d9679b82f Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 26 Oct 2022 14:00:15 +0200 Subject: [PATCH] Migrate temperature units to an enum (#81006) * Migrate temperature units to an enum * Adjust spacing --- homeassistant/const.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/homeassistant/const.py b/homeassistant/const.py index 78188533cd7..348e3720ee0 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -520,10 +520,22 @@ CURRENCY_EURO: Final = "€" CURRENCY_DOLLAR: Final = "$" CURRENCY_CENT: Final = "¢" + # Temperature units +class UnitOfTemperature(StrEnum): + """Temperature units.""" + + CELSIUS = "°C" + FAHRENHEIT = "°F" + KELVIN = "K" + + TEMP_CELSIUS: Final = "°C" +"""Deprecated: please use UnitOfTemperature.CELSIUS""" TEMP_FAHRENHEIT: Final = "°F" +"""Deprecated: please use UnitOfTemperature.FAHRENHEIT""" TEMP_KELVIN: Final = "K" +"""Deprecated: please use UnitOfTemperature.KELVIN""" # Time units TIME_MICROSECONDS: Final = "μs"