mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Migrate volume units to an enum (#81028)
* Migrate volume units to an enum * Adjust docstring * Deprecate -> Deprecated * Plural
This commit is contained in:
parent
3eea61361c
commit
a28b0e1b6f
@ -637,17 +637,38 @@ PRESSURE_PSI: Final = "psi"
|
||||
SOUND_PRESSURE_DB: Final = "dB"
|
||||
SOUND_PRESSURE_WEIGHTED_DBA: Final = "dBa"
|
||||
|
||||
|
||||
# Volume units
|
||||
class UnitOfVolume(StrEnum):
|
||||
"""Volume units."""
|
||||
|
||||
CUBIC_FEET = "ft³"
|
||||
CUBIC_METERS = "m³"
|
||||
LITERS = "L"
|
||||
MILLILITERS = "mL"
|
||||
GALLONS = "gal"
|
||||
"""Assumed to be US gallons in conversion utilities.
|
||||
|
||||
British/Imperial gallons are not yet supported"""
|
||||
FLUID_OUNCES = "fl. oz."
|
||||
"""Assumed to be US fluid ounces in conversion utilities.
|
||||
|
||||
British/Imperial fluid ounces are not yet supported"""
|
||||
|
||||
|
||||
VOLUME_LITERS: Final = "L"
|
||||
"""Deprecated: please use UnitOfVolume.LITERS"""
|
||||
VOLUME_MILLILITERS: Final = "mL"
|
||||
"""Deprecated: please use UnitOfVolume.MILLILITERS"""
|
||||
VOLUME_CUBIC_METERS: Final = "m³"
|
||||
"""Deprecated: please use UnitOfVolume.CUBIC_METERS"""
|
||||
VOLUME_CUBIC_FEET: Final = "ft³"
|
||||
"""Deprecated: please use UnitOfVolume.CUBIC_FEET"""
|
||||
|
||||
VOLUME_GALLONS: Final = "gal"
|
||||
"""US gallon (British gallon is not yet supported)"""
|
||||
|
||||
"""Deprecated: please use UnitOfVolume.GALLONS"""
|
||||
VOLUME_FLUID_OUNCE: Final = "fl. oz."
|
||||
"""US fluid ounce (British fluid ounce is not yet supported)"""
|
||||
"""Deprecated: please use UnitOfVolume.FLUID_OUNCES"""
|
||||
|
||||
# Volume Flow Rate units
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR: Final = "m³/h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user