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