From 9ee4d77935901dd4292458794c0bc4716f5eb8c2 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 26 Oct 2022 13:59:54 +0200 Subject: [PATCH] Migrate speed units to an enum (#81004) --- homeassistant/const.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/homeassistant/const.py b/homeassistant/const.py index 4f9eb8a8288..78188533cd7 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -701,12 +701,28 @@ CONCENTRATION_PARTS_PER_CUBIC_METER: Final = "p/m³" CONCENTRATION_PARTS_PER_MILLION: Final = "ppm" CONCENTRATION_PARTS_PER_BILLION: Final = "ppb" + # Speed units +class UnitOfSpeed(StrEnum): + """Speed units.""" + + FEET_PER_SECOND = "ft/s" + METERS_PER_SECOND = "m/s" + KILOMETERS_PER_HOUR = "km/h" + KNOTS = "kn" + MILES_PER_HOUR = "mph" + + SPEED_FEET_PER_SECOND: Final = "ft/s" +"""Deprecated: please use UnitOfSpeed.FEET_PER_SECOND""" SPEED_METERS_PER_SECOND: Final = "m/s" +"""Deprecated: please use UnitOfSpeed.METERS_PER_SECOND""" SPEED_KILOMETERS_PER_HOUR: Final = "km/h" +"""Deprecated: please use UnitOfSpeed.KILOMETERS_PER_HOUR""" SPEED_KNOTS: Final = "kn" +"""Deprecated: please use UnitOfSpeed.KNOTS""" SPEED_MILES_PER_HOUR: Final = "mph" +"""Deprecated: please use UnitOfSpeed.MILES_PER_HOUR""" SPEED_MILLIMETERS_PER_DAY: Final = "mm/d" """Deprecated: please use UnitOfVolumetricFlux.MILLIMETERS_PER_DAY"""