Add precipitation device class (#81145)
parent
fb909d694f
commit
dd960c4e62
|
@ -199,6 +199,14 @@ class NumberDeviceClass(StrEnum):
|
|||
Unit of measurement: `W`, `kW`
|
||||
"""
|
||||
|
||||
PRECIPITATION = "precipitation"
|
||||
"""Precipitation.
|
||||
|
||||
Unit of measurement:
|
||||
- SI / metric: `mm`
|
||||
- USCS / imperial: `in`
|
||||
"""
|
||||
|
||||
PRECIPITATION_INTENSITY = "precipitation_intensity"
|
||||
"""Precipitation intensity.
|
||||
|
||||
|
|
|
@ -254,6 +254,14 @@ class SensorDeviceClass(StrEnum):
|
|||
Unit of measurement: `W`, `kW`
|
||||
"""
|
||||
|
||||
PRECIPITATION = "precipitation"
|
||||
"""Precipitation.
|
||||
|
||||
Unit of measurement:
|
||||
- SI / metric: `mm`
|
||||
- USCS / imperial: `in`
|
||||
"""
|
||||
|
||||
PRECIPITATION_INTENSITY = "precipitation_intensity"
|
||||
"""Precipitation intensity.
|
||||
|
||||
|
@ -394,6 +402,7 @@ STATE_CLASSES: Final[list[str]] = [cls.value for cls in SensorStateClass]
|
|||
UNIT_CONVERTERS: dict[SensorDeviceClass | str | None, type[BaseUnitConverter]] = {
|
||||
SensorDeviceClass.DISTANCE: DistanceConverter,
|
||||
SensorDeviceClass.GAS: VolumeConverter,
|
||||
SensorDeviceClass.PRECIPITATION: DistanceConverter,
|
||||
SensorDeviceClass.PRESSURE: PressureConverter,
|
||||
SensorDeviceClass.SPEED: SpeedConverter,
|
||||
SensorDeviceClass.TEMPERATURE: TemperatureConverter,
|
||||
|
|
|
@ -52,6 +52,7 @@ CONF_IS_PM10 = "is_pm10"
|
|||
CONF_IS_PM25 = "is_pm25"
|
||||
CONF_IS_POWER = "is_power"
|
||||
CONF_IS_POWER_FACTOR = "is_power_factor"
|
||||
CONF_IS_PRECIPITATION = "is_precipitation"
|
||||
CONF_IS_PRECIPITATION_INTENSITY = "is_precipitation_intensity"
|
||||
CONF_IS_PRESSURE = "is_pressure"
|
||||
CONF_IS_SPEED = "is_speed"
|
||||
|
@ -89,6 +90,7 @@ ENTITY_CONDITIONS = {
|
|||
SensorDeviceClass.PM1: [{CONF_TYPE: CONF_IS_PM1}],
|
||||
SensorDeviceClass.PM10: [{CONF_TYPE: CONF_IS_PM10}],
|
||||
SensorDeviceClass.PM25: [{CONF_TYPE: CONF_IS_PM25}],
|
||||
SensorDeviceClass.PRECIPITATION: [{CONF_TYPE: CONF_IS_PRECIPITATION}],
|
||||
SensorDeviceClass.PRECIPITATION_INTENSITY: [
|
||||
{CONF_TYPE: CONF_IS_PRECIPITATION_INTENSITY}
|
||||
],
|
||||
|
|
|
@ -51,6 +51,7 @@ CONF_PM10 = "pm10"
|
|||
CONF_PM25 = "pm25"
|
||||
CONF_POWER = "power"
|
||||
CONF_POWER_FACTOR = "power_factor"
|
||||
CONF_PRECIPITATION = "precipitation"
|
||||
CONF_PRECIPITATION_INTENSITY = "precipitation_intensity"
|
||||
CONF_PRESSURE = "pressure"
|
||||
CONF_REACTIVE_POWER = "reactive_power"
|
||||
|
@ -88,6 +89,7 @@ ENTITY_TRIGGERS = {
|
|||
SensorDeviceClass.PM25: [{CONF_TYPE: CONF_PM25}],
|
||||
SensorDeviceClass.POWER: [{CONF_TYPE: CONF_POWER}],
|
||||
SensorDeviceClass.POWER_FACTOR: [{CONF_TYPE: CONF_POWER_FACTOR}],
|
||||
SensorDeviceClass.PRECIPITATION: [{CONF_TYPE: CONF_PRECIPITATION}],
|
||||
SensorDeviceClass.PRECIPITATION_INTENSITY: [
|
||||
{CONF_TYPE: CONF_PRECIPITATION_INTENSITY}
|
||||
],
|
||||
|
|
|
@ -256,6 +256,8 @@ METRIC_SYSTEM = UnitSystem(
|
|||
("distance", UnitOfLength.YARDS): UnitOfLength.METERS,
|
||||
# Convert non-metric volumes of gas meters
|
||||
("gas", UnitOfVolume.CUBIC_FEET): UnitOfVolume.CUBIC_METERS,
|
||||
# Convert non-metric precipitation
|
||||
("precipitation", UnitOfLength.INCHES): UnitOfLength.MILLIMETERS,
|
||||
# Convert non-metric speeds except knots to km/h
|
||||
("speed", UnitOfSpeed.FEET_PER_SECOND): UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
("speed", UnitOfSpeed.MILES_PER_HOUR): UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
|
@ -286,6 +288,8 @@ US_CUSTOMARY_SYSTEM = UnitSystem(
|
|||
("distance", UnitOfLength.MILLIMETERS): UnitOfLength.INCHES,
|
||||
# Convert non-USCS volumes of gas meters
|
||||
("gas", UnitOfVolume.CUBIC_METERS): UnitOfVolume.CUBIC_FEET,
|
||||
# Convert non-USCS precipitation
|
||||
("precipitation", UnitOfLength.MILLIMETERS): UnitOfLength.INCHES,
|
||||
# Convert non-USCS speeds except knots to mph
|
||||
("speed", UnitOfSpeed.METERS_PER_SECOND): UnitOfSpeed.MILES_PER_HOUR,
|
||||
("speed", UnitOfSpeed.KILOMETERS_PER_HOUR): UnitOfSpeed.MILES_PER_HOUR,
|
||||
|
|
Loading…
Reference in New Issue