mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Introduce unit enums for sound pressure (#83450)
* Introduce unit enums for sound pressure * Adjust based on architecture comment * Adjust
This commit is contained in:
parent
38f62ae622
commit
96c442349f
@ -27,6 +27,7 @@ from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
REVOLUTIONS_PER_MINUTE,
|
||||
UnitOfIrradiance,
|
||||
UnitOfSoundPressure,
|
||||
UnitOfVolume,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, State, callback, split_entity_id
|
||||
@ -55,6 +56,7 @@ DEFAULT_STATISTICS = {
|
||||
|
||||
EQUIVALENT_UNITS = {
|
||||
"BTU/(h×ft²)": UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT,
|
||||
"dBa": UnitOfSoundPressure.WEIGHTED_DECIBEL_A,
|
||||
"RPM": REVOLUTIONS_PER_MINUTE,
|
||||
"ft3": UnitOfVolume.CUBIC_FEET,
|
||||
"m3": UnitOfVolume.CUBIC_METERS,
|
||||
|
@ -702,9 +702,19 @@ PRESSURE_INHG: Final = "inHg"
|
||||
PRESSURE_PSI: Final = "psi"
|
||||
"""Deprecated: please use UnitOfPressure.PSI"""
|
||||
|
||||
|
||||
# Sound pressure units
|
||||
class UnitOfSoundPressure(StrEnum):
|
||||
"""Sound pressure units."""
|
||||
|
||||
DECIBEL = "dB"
|
||||
WEIGHTED_DECIBEL_A = "dBA"
|
||||
|
||||
|
||||
SOUND_PRESSURE_DB: Final = "dB"
|
||||
"""Deprecated: please use UnitOfSoundPressure.DECIBEL"""
|
||||
SOUND_PRESSURE_WEIGHTED_DBA: Final = "dBa"
|
||||
"""Deprecated: please use UnitOfSoundPressure.WEIGHTED_DECIBEL_A"""
|
||||
|
||||
|
||||
# Volume units
|
||||
|
Loading…
x
Reference in New Issue
Block a user