diff --git a/esphome/components/scd30/sensor.py b/esphome/components/scd30/sensor.py index 83fb9738ec..fb3ad713bb 100644 --- a/esphome/components/scd30/sensor.py +++ b/esphome/components/scd30/sensor.py @@ -18,6 +18,8 @@ from esphome.const import ( UNIT_CELSIUS, UNIT_PARTS_PER_MILLION, UNIT_PERCENT, + CONF_AUTOMATIC_SELF_CALIBRATION, + CONF_AMBIENT_PRESSURE_COMPENSATION, ) DEPENDENCIES = ["i2c"] @@ -33,10 +35,7 @@ ForceRecalibrationWithReference = scd30_ns.class_( "ForceRecalibrationWithReference", automation.Action ) -CONF_AUTOMATIC_SELF_CALIBRATION = "automatic_self_calibration" CONF_ALTITUDE_COMPENSATION = "altitude_compensation" -CONF_AMBIENT_PRESSURE_COMPENSATION = "ambient_pressure_compensation" - CONFIG_SCHEMA = ( cv.Schema( diff --git a/esphome/components/scd4x/sensor.py b/esphome/components/scd4x/sensor.py index f050c3ec34..f753f54c3b 100644 --- a/esphome/components/scd4x/sensor.py +++ b/esphome/components/scd4x/sensor.py @@ -20,6 +20,10 @@ from esphome.const import ( UNIT_CELSIUS, UNIT_PARTS_PER_MILLION, UNIT_PERCENT, + CONF_AUTOMATIC_SELF_CALIBRATION, + CONF_AMBIENT_PRESSURE_COMPENSATION, + CONF_AMBIENT_PRESSURE_COMPENSATION_SOURCE, + CONF_MEASUREMENT_MODE, ) CODEOWNERS = ["@sjtrny", "@martgras"] @@ -47,11 +51,6 @@ FactoryResetAction = scd4x_ns.class_("FactoryResetAction", automation.Action) CONF_ALTITUDE_COMPENSATION = "altitude_compensation" -CONF_AMBIENT_PRESSURE_COMPENSATION = "ambient_pressure_compensation" -CONF_AMBIENT_PRESSURE_COMPENSATION_SOURCE = "ambient_pressure_compensation_source" -CONF_AUTOMATIC_SELF_CALIBRATION = "automatic_self_calibration" -CONF_MEASUREMENT_MODE = "measurement_mode" - CONFIG_SCHEMA = ( cv.Schema( diff --git a/esphome/components/sdp3x/sensor.py b/esphome/components/sdp3x/sensor.py index 67f3f9561f..7cda2779ce 100644 --- a/esphome/components/sdp3x/sensor.py +++ b/esphome/components/sdp3x/sensor.py @@ -5,6 +5,7 @@ from esphome.const import ( DEVICE_CLASS_PRESSURE, STATE_CLASS_MEASUREMENT, UNIT_HECTOPASCAL, + CONF_MEASUREMENT_MODE, ) DEPENDENCIES = ["i2c"] @@ -22,7 +23,7 @@ MEASUREMENT_MODE = { "mass_flow": MeasurementMode.MASS_FLOW_AVG, "differential_pressure": MeasurementMode.DP_AVG, } -CONF_MEASUREMENT_MODE = "measurement_mode" + CONFIG_SCHEMA = ( sensor.sensor_schema( diff --git a/esphome/const.py b/esphome/const.py index 31da9c56ea..a21e18730f 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -45,6 +45,8 @@ CONF_ALLOW_OTHER_USES = "allow_other_uses" CONF_ALPHA = "alpha" CONF_ALTITUDE = "altitude" CONF_AMBIENT_LIGHT = "ambient_light" +CONF_AMBIENT_PRESSURE_COMPENSATION = "ambient_pressure_compensation" +CONF_AMBIENT_PRESSURE_COMPENSATION_SOURCE = "ambient_pressure_compensation_source" CONF_AMMONIA = "ammonia" CONF_ANALOG = "analog" CONF_AND = "and" @@ -63,6 +65,7 @@ CONF_AUTH = "auth" CONF_AUTO_CLEAR_ENABLED = "auto_clear_enabled" CONF_AUTO_MODE = "auto_mode" CONF_AUTOCONF = "autoconf" +CONF_AUTOMATIC_SELF_CALIBRATION = "automatic_self_calibration" CONF_AUTOMATION_ID = "automation_id" CONF_AVAILABILITY = "availability" CONF_AWAY = "away" @@ -477,6 +480,7 @@ CONF_MAX_VALUE = "max_value" CONF_MAX_VOLTAGE = "max_voltage" CONF_MDNS = "mdns" CONF_MEASUREMENT_DURATION = "measurement_duration" +CONF_MEASUREMENT_MODE = "measurement_mode" CONF_MEASUREMENT_SEQUENCE_NUMBER = "measurement_sequence_number" CONF_MEDIA_PLAYER = "media_player" CONF_MEDIUM = "medium"