mirror of
https://github.com/home-assistant/core.git
synced 2025-09-10 15:21:38 +02:00
Add m³/min as volume flow rate unit (#151051)
This commit is contained in:
@@ -418,7 +418,7 @@ class NumberDeviceClass(StrEnum):
|
|||||||
"""Generic flow rate
|
"""Generic flow rate
|
||||||
|
|
||||||
Unit of measurement: UnitOfVolumeFlowRate
|
Unit of measurement: UnitOfVolumeFlowRate
|
||||||
- SI / metric: `m³/h`, `L/min`, `mL/s`
|
- SI / metric: `m³/h`, `m³/min`, `m³/s`, `L/h`, `L/min`, `L/s`, `mL/s`
|
||||||
- USCS / imperial: `ft³/min`, `gal/min`
|
- USCS / imperial: `ft³/min`, `gal/min`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@@ -452,7 +452,7 @@ class SensorDeviceClass(StrEnum):
|
|||||||
"""Generic flow rate
|
"""Generic flow rate
|
||||||
|
|
||||||
Unit of measurement: UnitOfVolumeFlowRate
|
Unit of measurement: UnitOfVolumeFlowRate
|
||||||
- SI / metric: `m³/h`, `L/min`, `mL/s`
|
- SI / metric: `m³/h`, `m³/min`, `m³/s`, `L/h`, `L/min`, `L/s`, `mL/s`
|
||||||
- USCS / imperial: `ft³/min`, `gal/min`
|
- USCS / imperial: `ft³/min`, `gal/min`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@@ -783,6 +783,7 @@ class UnitOfVolumeFlowRate(StrEnum):
|
|||||||
"""Volume flow rate units."""
|
"""Volume flow rate units."""
|
||||||
|
|
||||||
CUBIC_METERS_PER_HOUR = "m³/h"
|
CUBIC_METERS_PER_HOUR = "m³/h"
|
||||||
|
CUBIC_METERS_PER_MINUTE = "m³/min"
|
||||||
CUBIC_METERS_PER_SECOND = "m³/s"
|
CUBIC_METERS_PER_SECOND = "m³/s"
|
||||||
CUBIC_FEET_PER_MINUTE = "ft³/min"
|
CUBIC_FEET_PER_MINUTE = "ft³/min"
|
||||||
LITERS_PER_HOUR = "L/h"
|
LITERS_PER_HOUR = "L/h"
|
||||||
|
@@ -769,6 +769,7 @@ class VolumeFlowRateConverter(BaseUnitConverter):
|
|||||||
# Units in terms of m³/h
|
# Units in terms of m³/h
|
||||||
_UNIT_CONVERSION: dict[str | None, float] = {
|
_UNIT_CONVERSION: dict[str | None, float] = {
|
||||||
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR: 1,
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR: 1,
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_MINUTE: 1 / _HRS_TO_MINUTES,
|
||||||
UnitOfVolumeFlowRate.CUBIC_METERS_PER_SECOND: 1 / _HRS_TO_SECS,
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_SECOND: 1 / _HRS_TO_SECS,
|
||||||
UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE: 1
|
UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE: 1
|
||||||
/ (_HRS_TO_MINUTES * _CUBIC_FOOT_TO_CUBIC_METER),
|
/ (_HRS_TO_MINUTES * _CUBIC_FOOT_TO_CUBIC_METER),
|
||||||
@@ -784,6 +785,7 @@ class VolumeFlowRateConverter(BaseUnitConverter):
|
|||||||
VALID_UNITS = {
|
VALID_UNITS = {
|
||||||
UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE,
|
UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE,
|
||||||
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_MINUTE,
|
||||||
UnitOfVolumeFlowRate.CUBIC_METERS_PER_SECOND,
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_SECOND,
|
||||||
UnitOfVolumeFlowRate.LITERS_PER_HOUR,
|
UnitOfVolumeFlowRate.LITERS_PER_HOUR,
|
||||||
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
|
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
|
||||||
|
@@ -947,6 +947,12 @@ _CONVERTED_VALUE: dict[
|
|||||||
1,
|
1,
|
||||||
UnitOfVolumeFlowRate.LITERS_PER_SECOND,
|
UnitOfVolumeFlowRate.LITERS_PER_SECOND,
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
0.6,
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_MINUTE,
|
||||||
|
10,
|
||||||
|
UnitOfVolumeFlowRate.LITERS_PER_SECOND,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user