Fix units for SPS30 number concentration sensors (#5452)

This commit is contained in:
kahrendt 2023-10-03 06:01:57 -04:00 committed by GitHub
parent 88bb051f37
commit 050fa0d4c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -20,7 +20,7 @@ from esphome.const import (
DEVICE_CLASS_PM25, DEVICE_CLASS_PM25,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
UNIT_MICROGRAMS_PER_CUBIC_METER, UNIT_MICROGRAMS_PER_CUBIC_METER,
UNIT_COUNTS_PER_CUBIC_METER, UNIT_COUNTS_PER_CUBIC_CENTIMETER,
UNIT_MICROMETER, UNIT_MICROMETER,
ICON_CHEMICAL_WEAPON, ICON_CHEMICAL_WEAPON,
ICON_COUNTER, ICON_COUNTER,
@ -73,31 +73,31 @@ CONFIG_SCHEMA = (
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PMC_0_5): sensor.sensor_schema( cv.Optional(CONF_PMC_0_5): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNTS_PER_CUBIC_METER, unit_of_measurement=UNIT_COUNTS_PER_CUBIC_CENTIMETER,
icon=ICON_COUNTER, icon=ICON_COUNTER,
accuracy_decimals=2, accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PMC_1_0): sensor.sensor_schema( cv.Optional(CONF_PMC_1_0): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNTS_PER_CUBIC_METER, unit_of_measurement=UNIT_COUNTS_PER_CUBIC_CENTIMETER,
icon=ICON_COUNTER, icon=ICON_COUNTER,
accuracy_decimals=2, accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PMC_2_5): sensor.sensor_schema( cv.Optional(CONF_PMC_2_5): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNTS_PER_CUBIC_METER, unit_of_measurement=UNIT_COUNTS_PER_CUBIC_CENTIMETER,
icon=ICON_COUNTER, icon=ICON_COUNTER,
accuracy_decimals=2, accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PMC_4_0): sensor.sensor_schema( cv.Optional(CONF_PMC_4_0): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNTS_PER_CUBIC_METER, unit_of_measurement=UNIT_COUNTS_PER_CUBIC_CENTIMETER,
icon=ICON_COUNTER, icon=ICON_COUNTER,
accuracy_decimals=2, accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PMC_10_0): sensor.sensor_schema( cv.Optional(CONF_PMC_10_0): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNTS_PER_CUBIC_METER, unit_of_measurement=UNIT_COUNTS_PER_CUBIC_CENTIMETER,
icon=ICON_COUNTER, icon=ICON_COUNTER,
accuracy_decimals=2, accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,

View file

@ -915,7 +915,7 @@ UNIT_BYTES = "B"
UNIT_CELSIUS = "°C" UNIT_CELSIUS = "°C"
UNIT_CENTIMETER = "cm" UNIT_CENTIMETER = "cm"
UNIT_COUNT_DECILITRE = "/dL" UNIT_COUNT_DECILITRE = "/dL"
UNIT_COUNTS_PER_CUBIC_METER = "#/" UNIT_COUNTS_PER_CUBIC_CENTIMETER = "#/c"
UNIT_CUBIC_METER = "" UNIT_CUBIC_METER = ""
UNIT_CUBIC_METER_PER_HOUR = "m³/h" UNIT_CUBIC_METER_PER_HOUR = "m³/h"
UNIT_DECIBEL = "dB" UNIT_DECIBEL = "dB"