mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Introduce unit enums for irradiance (#83414)
This commit is contained in:
parent
0eacd84ff3
commit
90438edc17
@ -26,8 +26,8 @@ from homeassistant.components.recorder.models import (
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
REVOLUTIONS_PER_MINUTE,
|
||||
VOLUME_CUBIC_FEET,
|
||||
VOLUME_CUBIC_METERS,
|
||||
UnitOfIrradiance,
|
||||
UnitOfVolume,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, State, callback, split_entity_id
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
@ -54,9 +54,10 @@ DEFAULT_STATISTICS = {
|
||||
}
|
||||
|
||||
EQUIVALENT_UNITS = {
|
||||
"BTU/(h×ft²)": UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT,
|
||||
"RPM": REVOLUTIONS_PER_MINUTE,
|
||||
"ft3": VOLUME_CUBIC_FEET,
|
||||
"m3": VOLUME_CUBIC_METERS,
|
||||
"ft3": UnitOfVolume.CUBIC_FEET,
|
||||
"m3": UnitOfVolume.CUBIC_METERS,
|
||||
}
|
||||
|
||||
# Keep track of entities for which a warning about decreasing value has been logged
|
||||
|
@ -787,9 +787,20 @@ PERCENTAGE: Final = "%"
|
||||
# Rotational speed units
|
||||
REVOLUTIONS_PER_MINUTE: Final = "rpm"
|
||||
|
||||
|
||||
# Irradiance units
|
||||
class UnitOfIrradiance(StrEnum):
|
||||
"""Irradiance units."""
|
||||
|
||||
WATTS_PER_SQUARE_METER = "W/m²"
|
||||
BTUS_PER_HOUR_SQUARE_FOOT = "BTU/(h⋅ft²)"
|
||||
|
||||
|
||||
# Irradiation units
|
||||
IRRADIATION_WATTS_PER_SQUARE_METER: Final = "W/m²"
|
||||
"""Deprecated: please use UnitOfIrradiance.WATTS_PER_SQUARE_METER"""
|
||||
IRRADIATION_BTUS_PER_HOUR_SQUARE_FOOT: Final = "BTU/(h×ft²)"
|
||||
"""Deprecated: please use UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT"""
|
||||
|
||||
|
||||
class UnitOfVolumetricFlux(StrEnum):
|
||||
@ -800,16 +811,16 @@ class UnitOfVolumetricFlux(StrEnum):
|
||||
"""
|
||||
|
||||
INCHES_PER_DAY = "in/d"
|
||||
"""Derived from in³/(in².d)"""
|
||||
"""Derived from in³/(in²⋅d)"""
|
||||
|
||||
INCHES_PER_HOUR = "in/h"
|
||||
"""Derived from in³/(in².h)"""
|
||||
"""Derived from in³/(in²⋅h)"""
|
||||
|
||||
MILLIMETERS_PER_DAY = "mm/d"
|
||||
"""Derived from mm³/(mm².d)"""
|
||||
"""Derived from mm³/(mm²⋅d)"""
|
||||
|
||||
MILLIMETERS_PER_HOUR = "mm/h"
|
||||
"""Derived from mm³/(mm².h)"""
|
||||
"""Derived from mm³/(mm²⋅h)"""
|
||||
|
||||
|
||||
class UnitOfPrecipitationDepth(StrEnum):
|
||||
|
Loading…
x
Reference in New Issue
Block a user