mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +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 (
|
from homeassistant.const import (
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
REVOLUTIONS_PER_MINUTE,
|
REVOLUTIONS_PER_MINUTE,
|
||||||
VOLUME_CUBIC_FEET,
|
UnitOfIrradiance,
|
||||||
VOLUME_CUBIC_METERS,
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, State, callback, split_entity_id
|
from homeassistant.core import HomeAssistant, State, callback, split_entity_id
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
@ -54,9 +54,10 @@ DEFAULT_STATISTICS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EQUIVALENT_UNITS = {
|
EQUIVALENT_UNITS = {
|
||||||
|
"BTU/(h×ft²)": UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT,
|
||||||
"RPM": REVOLUTIONS_PER_MINUTE,
|
"RPM": REVOLUTIONS_PER_MINUTE,
|
||||||
"ft3": VOLUME_CUBIC_FEET,
|
"ft3": UnitOfVolume.CUBIC_FEET,
|
||||||
"m3": VOLUME_CUBIC_METERS,
|
"m3": UnitOfVolume.CUBIC_METERS,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Keep track of entities for which a warning about decreasing value has been logged
|
# Keep track of entities for which a warning about decreasing value has been logged
|
||||||
|
@ -787,9 +787,20 @@ PERCENTAGE: Final = "%"
|
|||||||
# Rotational speed units
|
# Rotational speed units
|
||||||
REVOLUTIONS_PER_MINUTE: Final = "rpm"
|
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 units
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER: Final = "W/m²"
|
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²)"
|
IRRADIATION_BTUS_PER_HOUR_SQUARE_FOOT: Final = "BTU/(h×ft²)"
|
||||||
|
"""Deprecated: please use UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT"""
|
||||||
|
|
||||||
|
|
||||||
class UnitOfVolumetricFlux(StrEnum):
|
class UnitOfVolumetricFlux(StrEnum):
|
||||||
@ -800,16 +811,16 @@ class UnitOfVolumetricFlux(StrEnum):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
INCHES_PER_DAY = "in/d"
|
INCHES_PER_DAY = "in/d"
|
||||||
"""Derived from in³/(in².d)"""
|
"""Derived from in³/(in²⋅d)"""
|
||||||
|
|
||||||
INCHES_PER_HOUR = "in/h"
|
INCHES_PER_HOUR = "in/h"
|
||||||
"""Derived from in³/(in².h)"""
|
"""Derived from in³/(in²⋅h)"""
|
||||||
|
|
||||||
MILLIMETERS_PER_DAY = "mm/d"
|
MILLIMETERS_PER_DAY = "mm/d"
|
||||||
"""Derived from mm³/(mm².d)"""
|
"""Derived from mm³/(mm²⋅d)"""
|
||||||
|
|
||||||
MILLIMETERS_PER_HOUR = "mm/h"
|
MILLIMETERS_PER_HOUR = "mm/h"
|
||||||
"""Derived from mm³/(mm².h)"""
|
"""Derived from mm³/(mm²⋅h)"""
|
||||||
|
|
||||||
|
|
||||||
class UnitOfPrecipitationDepth(StrEnum):
|
class UnitOfPrecipitationDepth(StrEnum):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user