mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add new units L/h , L/s and m³/s to volume flow rate sensor device class (#143625)
add new units L/h , L/s and m³/s
This commit is contained in:
parent
d83c617566
commit
3405b2549b
@ -766,8 +766,11 @@ 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_SECOND = "m³/s"
|
||||||
CUBIC_FEET_PER_MINUTE = "ft³/min"
|
CUBIC_FEET_PER_MINUTE = "ft³/min"
|
||||||
|
LITERS_PER_HOUR = "L/h"
|
||||||
LITERS_PER_MINUTE = "L/min"
|
LITERS_PER_MINUTE = "L/min"
|
||||||
|
LITERS_PER_SECOND = "L/s"
|
||||||
GALLONS_PER_MINUTE = "gal/min"
|
GALLONS_PER_MINUTE = "gal/min"
|
||||||
MILLILITERS_PER_SECOND = "mL/s"
|
MILLILITERS_PER_SECOND = "mL/s"
|
||||||
|
|
||||||
|
@ -705,10 +705,13 @@ 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_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),
|
||||||
|
UnitOfVolumeFlowRate.LITERS_PER_HOUR: 1 / _L_TO_CUBIC_METER,
|
||||||
UnitOfVolumeFlowRate.LITERS_PER_MINUTE: 1
|
UnitOfVolumeFlowRate.LITERS_PER_MINUTE: 1
|
||||||
/ (_HRS_TO_MINUTES * _L_TO_CUBIC_METER),
|
/ (_HRS_TO_MINUTES * _L_TO_CUBIC_METER),
|
||||||
|
UnitOfVolumeFlowRate.LITERS_PER_SECOND: 1 / (_HRS_TO_SECS * _L_TO_CUBIC_METER),
|
||||||
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 1
|
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE: 1
|
||||||
/ (_HRS_TO_MINUTES * _GALLON_TO_CUBIC_METER),
|
/ (_HRS_TO_MINUTES * _GALLON_TO_CUBIC_METER),
|
||||||
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND: 1
|
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND: 1
|
||||||
@ -717,7 +720,10 @@ 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_SECOND,
|
||||||
|
UnitOfVolumeFlowRate.LITERS_PER_HOUR,
|
||||||
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
|
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
|
||||||
|
UnitOfVolumeFlowRate.LITERS_PER_SECOND,
|
||||||
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
|
UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
|
||||||
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
|
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
|
||||||
}
|
}
|
||||||
|
@ -806,12 +806,30 @@ _CONVERTED_VALUE: dict[
|
|||||||
2500,
|
2500,
|
||||||
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
|
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_SECOND,
|
||||||
|
3600,
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_SECOND,
|
||||||
|
3600000,
|
||||||
|
UnitOfVolumeFlowRate.LITERS_PER_HOUR,
|
||||||
|
),
|
||||||
(
|
(
|
||||||
3,
|
3,
|
||||||
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
|
UnitOfVolumeFlowRate.LITERS_PER_MINUTE,
|
||||||
50,
|
50,
|
||||||
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
|
UnitOfVolumeFlowRate.MILLILITERS_PER_SECOND,
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
3.6,
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||||
|
1,
|
||||||
|
UnitOfVolumeFlowRate.LITERS_PER_SECOND,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user