Use UnitOfVolumeFlowRate in integrations (#84348)
This commit is contained in:
parent
9a488cf250
commit
2f45e6c2ae
8 changed files with 23 additions and 26 deletions
|
@ -25,7 +25,6 @@ from homeassistant.const import (
|
|||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfEnergy,
|
||||
|
@ -37,6 +36,7 @@ from homeassistant.const import (
|
|||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
UnitOfVolumeFlowRate,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
|
@ -280,7 +280,7 @@ SENSOR_DESCRIPTIONS = {
|
|||
Units.VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
): SensorEntityDescription(
|
||||
key=f"{BTHomeSensorDeviceClass.VOLUME_FLOW_RATE}_{Units.VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR}",
|
||||
native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@ from homeassistant.const import (
|
|||
CONF_RESOURCES,
|
||||
PERCENTAGE,
|
||||
REVOLUTIONS_PER_MINUTE,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
UnitOfEnergy,
|
||||
UnitOfPower,
|
||||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolumeFlowRate,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -209,7 +209,7 @@ SENSOR_TYPES = (
|
|||
key=ATTR_AIR_FLOW_SUPPLY,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
name="Supply airflow",
|
||||
native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
icon="mdi:fan-plus",
|
||||
sensor_id=SENSOR_FAN_SUPPLY_FLOW,
|
||||
),
|
||||
|
@ -217,7 +217,7 @@ SENSOR_TYPES = (
|
|||
key=ATTR_AIR_FLOW_EXHAUST,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
name="Exhaust airflow",
|
||||
native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
icon="mdi:fan-minus",
|
||||
sensor_id=SENSOR_FAN_EXHAUST_FLOW,
|
||||
),
|
||||
|
|
|
@ -33,8 +33,6 @@ from homeassistant.const import (
|
|||
STATE_UNKNOWN,
|
||||
STATE_UNLOCKED,
|
||||
UV_INDEX,
|
||||
VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
Platform,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
|
@ -50,6 +48,7 @@ from homeassistant.const import (
|
|||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
UnitOfVolumeFlowRate,
|
||||
UnitOfVolumetricFlux,
|
||||
)
|
||||
|
||||
|
@ -298,7 +297,7 @@ UOM_FRIENDLY_NAME = {
|
|||
"4": UnitOfTemperature.CELSIUS,
|
||||
"5": UnitOfLength.CENTIMETERS,
|
||||
"6": UnitOfVolume.CUBIC_FEET,
|
||||
"7": VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE,
|
||||
"7": UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE,
|
||||
"8": UnitOfVolume.CUBIC_METERS,
|
||||
"9": UnitOfTime.DAYS,
|
||||
"10": UnitOfTime.DAYS,
|
||||
|
@ -328,7 +327,7 @@ UOM_FRIENDLY_NAME = {
|
|||
"36": LIGHT_LUX,
|
||||
"37": "mercalli",
|
||||
"38": UnitOfLength.METERS,
|
||||
"39": VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
"39": UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
"40": UnitOfSpeed.METERS_PER_SECOND,
|
||||
"41": UnitOfElectricCurrent.MILLIAMPERE,
|
||||
"42": UnitOfTime.MILLISECONDS,
|
||||
|
|
|
@ -6,12 +6,12 @@ from homeassistant.components.sensor import (
|
|||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
UnitOfEnergy,
|
||||
UnitOfPower,
|
||||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
UnitOfVolumeFlowRate,
|
||||
)
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
|
||||
|
@ -111,14 +111,14 @@ HEAT_METER_SENSOR_TYPES = (
|
|||
SensorEntityDescription(
|
||||
key="flowrate_max_m3ph",
|
||||
name="Flowrate max",
|
||||
native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
icon="mdi:water-outline",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="flowrate_max_previous_year_m3ph",
|
||||
name="Flowrate max previous year",
|
||||
native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
icon="mdi:water-outline",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
|
@ -200,7 +200,7 @@ HEAT_METER_SENSOR_TYPES = (
|
|||
SensorEntityDescription(
|
||||
key="measuring_range_m3ph",
|
||||
name="Measuring range",
|
||||
native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
icon="mdi:water-outline",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
|
|
|
@ -21,10 +21,10 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import (
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
Platform,
|
||||
UnitOfPressure,
|
||||
UnitOfTemperature,
|
||||
UnitOfVolumeFlowRate,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -139,7 +139,7 @@ DEVICE_ENTITY: dict[
|
|||
name="Flow",
|
||||
measurement_to_ha=lambda x: x / 10,
|
||||
subscribe_attributes=(clusters.FlowMeasurement.Attributes.MeasuredValue,),
|
||||
native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
),
|
||||
device_types.HumiditySensor: MatterSensorEntityDescriptionFactory(
|
||||
key=device_types.HumiditySensor,
|
||||
|
|
|
@ -20,12 +20,12 @@ from homeassistant.const import (
|
|||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
UnitOfEnergy,
|
||||
UnitOfPower,
|
||||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
UnitOfVolumeFlowRate,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
||||
|
@ -116,7 +116,7 @@ SENSOR_DESCRIPTIONS: list[OverkizSensorDescription] = [
|
|||
key=OverkizState.IO_INLET_ENGINE,
|
||||
name="Inlet engine",
|
||||
icon="mdi:fan-chevron-up",
|
||||
native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
OverkizSensorDescription(
|
||||
|
|
|
@ -20,8 +20,6 @@ from homeassistant.const import (
|
|||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
Platform,
|
||||
UnitOfApparentPower,
|
||||
UnitOfElectricCurrent,
|
||||
|
@ -34,6 +32,7 @@ from homeassistant.const import (
|
|||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
UnitOfVolumeFlowRate,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
@ -423,9 +422,9 @@ class SmartEnergyMetering(Sensor):
|
|||
|
||||
unit_of_measure_map = {
|
||||
0x00: UnitOfPower.WATT,
|
||||
0x01: VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
0x02: VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE,
|
||||
0x03: f"100 {VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR}",
|
||||
0x01: UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
0x02: UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE,
|
||||
0x03: f"100 {UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR}",
|
||||
0x04: f"US {UnitOfVolume.GALLONS}/{UnitOfTime.HOURS}",
|
||||
0x05: f"IMP {UnitOfVolume.GALLONS}/{UnitOfTime.HOURS}",
|
||||
0x06: UnitOfPower.BTU_PER_HOUR,
|
||||
|
|
|
@ -96,8 +96,6 @@ from homeassistant.const import (
|
|||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfEnergy,
|
||||
|
@ -111,6 +109,7 @@ from homeassistant.const import (
|
|||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
UnitOfVolumeFlowRate,
|
||||
UnitOfVolumetricFlux,
|
||||
)
|
||||
|
||||
|
@ -172,9 +171,9 @@ MULTILEVEL_SENSOR_UNIT_MAP: dict[str, set[MultilevelSensorScaleType]] = {
|
|||
UnitOfPower.BTU_PER_HOUR: UNIT_BTU_H,
|
||||
UnitOfTemperature.CELSIUS: UNIT_CELSIUS,
|
||||
UnitOfLength.CENTIMETERS: UNIT_CENTIMETER,
|
||||
VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE: UNIT_CUBIC_FEET_PER_MINUTE,
|
||||
UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE: UNIT_CUBIC_FEET_PER_MINUTE,
|
||||
UnitOfVolume.CUBIC_METERS: SENSOR_UNIT_CUBIC_METER,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR: UNIT_CUBIC_METER_PER_HOUR,
|
||||
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR: UNIT_CUBIC_METER_PER_HOUR,
|
||||
SIGNAL_STRENGTH_DECIBELS: UNIT_DECIBEL,
|
||||
DEGREE: UNIT_DEGREES,
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue