Allow mL/s as UnitOfVolumeFlowRate (#130771)

This commit is contained in:
Josef Zweck 2024-11-21 20:47:24 +01:00 committed by GitHub
parent 797eb606fe
commit 3cfd958dc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 2 deletions

View File

@ -404,7 +404,7 @@ class NumberDeviceClass(StrEnum):
"""Generic flow rate
Unit of measurement: UnitOfVolumeFlowRate
- SI / metric: `/h`, `L/min`
- SI / metric: `/h`, `L/min`, `mL/s`
- USCS / imperial: `ft³/min`, `gal/min`
"""

View File

@ -427,7 +427,7 @@ class SensorDeviceClass(StrEnum):
"""Generic flow rate
Unit of measurement: UnitOfVolumeFlowRate
- SI / metric: `/h`, `L/min`
- SI / metric: `/h`, `L/min`, `mL/s`
- USCS / imperial: `ft³/min`, `gal/min`
"""

View File

@ -1166,6 +1166,7 @@ class UnitOfVolumeFlowRate(StrEnum):
CUBIC_FEET_PER_MINUTE = "ft³/min"
LITERS_PER_MINUTE = "L/min"
GALLONS_PER_MINUTE = "gal/min"
MILLILITERS_PER_SECOND = "mL/s"
_DEPRECATED_VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR: Final = DeprecatedConstantEnum(

View File

@ -666,12 +666,15 @@ class VolumeFlowRateConverter(BaseUnitConverter):
/ (_HRS_TO_MINUTES * _L_TO_CUBIC_METER),
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 1
/ (_HRS_TO_MINUTES * _GALLON_TO_CUBIC_METER),
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND: 1
/ (_HRS_TO_SECS * _ML_TO_CUBIC_METER),
}
VALID_UNITS = {
UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE,
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
}

View File

@ -743,6 +743,18 @@ _CONVERTED_VALUE: dict[
7.48051948,
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
),
(
9,
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
2500,
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
),
(
3,
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
50,
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
),
],
}