Add m³/min as volume flow rate unit (#151051)

This commit is contained in:
Christian Fetzer
2025-08-24 21:30:25 +02:00
committed by GitHub
parent b018465a4d
commit 0dc2a5a02c
5 changed files with 11 additions and 2 deletions

View File

@@ -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`
""" """

View File

@@ -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`
""" """

View File

@@ -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"

View File

@@ -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,

View File

@@ -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,
),
], ],
} }