Update const.py added missing millimeter (#6834)

* Update const.py added missing millimeter

Added missing millimeter

* Fixed UNIT_MILLIMETER in multiple locations.
This commit is contained in:
NonaSuomy 2024-05-31 01:13:11 -04:00 committed by GitHub
parent 8dfe1d5220
commit 2894a138e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 9 additions and 10 deletions

View file

@ -4,11 +4,11 @@ from esphome.const import (
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
ICON_ARROW_EXPAND_VERTICAL, ICON_ARROW_EXPAND_VERTICAL,
DEVICE_CLASS_DISTANCE, DEVICE_CLASS_DISTANCE,
UNIT_MILLIMETER,
) )
CODEOWNERS = ["@TH-Braemer"] CODEOWNERS = ["@TH-Braemer"]
DEPENDENCIES = ["uart"] DEPENDENCIES = ["uart"]
UNIT_MILLIMETERS = "mm"
a02yyuw_ns = cg.esphome_ns.namespace("a02yyuw") a02yyuw_ns = cg.esphome_ns.namespace("a02yyuw")
A02yyuwComponent = a02yyuw_ns.class_( A02yyuwComponent = a02yyuw_ns.class_(
@ -17,7 +17,7 @@ A02yyuwComponent = a02yyuw_ns.class_(
CONFIG_SCHEMA = sensor.sensor_schema( CONFIG_SCHEMA = sensor.sensor_schema(
A02yyuwComponent, A02yyuwComponent,
unit_of_measurement=UNIT_MILLIMETERS, unit_of_measurement=UNIT_MILLIMETER,
icon=ICON_ARROW_EXPAND_VERTICAL, icon=ICON_ARROW_EXPAND_VERTICAL,
accuracy_decimals=0, accuracy_decimals=0,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,

View file

@ -12,13 +12,13 @@ from esphome.const import (
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING, STATE_CLASS_TOTAL_INCREASING,
UNIT_CELSIUS, UNIT_CELSIUS,
UNIT_MILLIMETER,
ICON_THERMOMETER, ICON_THERMOMETER,
) )
from . import RGModel, RG15Resolution, HydreonRGxxComponent from . import RGModel, RG15Resolution, HydreonRGxxComponent
UNIT_INTENSITY = "intensity" UNIT_INTENSITY = "intensity"
UNIT_MILLIMETERS = "mm"
UNIT_MILLIMETERS_PER_HOUR = "mm/h" UNIT_MILLIMETERS_PER_HOUR = "mm/h"
CONF_ACC = "acc" CONF_ACC = "acc"
@ -85,19 +85,19 @@ CONFIG_SCHEMA = cv.All(
), ),
cv.Optional(CONF_RESOLUTION): cv.enum(RG15_RESOLUTION, upper=False), cv.Optional(CONF_RESOLUTION): cv.enum(RG15_RESOLUTION, upper=False),
cv.Optional(CONF_ACC): sensor.sensor_schema( cv.Optional(CONF_ACC): sensor.sensor_schema(
unit_of_measurement=UNIT_MILLIMETERS, unit_of_measurement=UNIT_MILLIMETER,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_PRECIPITATION, device_class=DEVICE_CLASS_PRECIPITATION,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_EVENT_ACC): sensor.sensor_schema( cv.Optional(CONF_EVENT_ACC): sensor.sensor_schema(
unit_of_measurement=UNIT_MILLIMETERS, unit_of_measurement=UNIT_MILLIMETER,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_PRECIPITATION, device_class=DEVICE_CLASS_PRECIPITATION,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_TOTAL_ACC): sensor.sensor_schema( cv.Optional(CONF_TOTAL_ACC): sensor.sensor_schema(
unit_of_measurement=UNIT_MILLIMETERS, unit_of_measurement=UNIT_MILLIMETER,
accuracy_decimals=2, accuracy_decimals=2,
device_class=DEVICE_CLASS_PRECIPITATION, device_class=DEVICE_CLASS_PRECIPITATION,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=STATE_CLASS_TOTAL_INCREASING,

View file

@ -12,6 +12,7 @@ from esphome.const import (
CONF_TEMPERATURE, CONF_TEMPERATURE,
DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TEMPERATURE,
UNIT_CELSIUS, UNIT_CELSIUS,
UNIT_MILLIMETER,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
CONF_BATTERY_LEVEL, CONF_BATTERY_LEVEL,
DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY,
@ -25,8 +26,6 @@ ICON_PROPANE_TANK = "mdi:propane-tank"
TANK_TYPE_CUSTOM = "CUSTOM" TANK_TYPE_CUSTOM = "CUSTOM"
UNIT_MILLIMETER = "mm"
def small_distance(value): def small_distance(value):
"""small_distance is stored in mm""" """small_distance is stored in mm"""

View file

@ -12,6 +12,7 @@ from esphome.const import (
CONF_TEMPERATURE, CONF_TEMPERATURE,
DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TEMPERATURE,
UNIT_CELSIUS, UNIT_CELSIUS,
UNIT_MILLIMETER,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
CONF_BATTERY_LEVEL, CONF_BATTERY_LEVEL,
DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY,
@ -26,8 +27,6 @@ ICON_PROPANE_TANK = "mdi:propane-tank"
TANK_TYPE_CUSTOM = "CUSTOM" TANK_TYPE_CUSTOM = "CUSTOM"
UNIT_MILLIMETER = "mm"
def small_distance(value): def small_distance(value):
"""small_distance is stored in mm""" """small_distance is stored in mm"""

View file

@ -1035,6 +1035,7 @@ UNIT_MICROSIEMENS_PER_CENTIMETER = "µS/cm"
UNIT_MICROSILVERTS_PER_HOUR = "µSv/h" UNIT_MICROSILVERTS_PER_HOUR = "µSv/h"
UNIT_MICROTESLA = "µT" UNIT_MICROTESLA = "µT"
UNIT_MILLIGRAMS_PER_CUBIC_METER = "mg/m³" UNIT_MILLIGRAMS_PER_CUBIC_METER = "mg/m³"
UNIT_MILLIMETER = "mm"
UNIT_MILLISECOND = "ms" UNIT_MILLISECOND = "ms"
UNIT_MILLISIEMENS_PER_CENTIMETER = "mS/cm" UNIT_MILLISIEMENS_PER_CENTIMETER = "mS/cm"
UNIT_MINUTE = "min" UNIT_MINUTE = "min"