PMSx003 add relevant device and state classes to default config (#5633)

This commit is contained in:
William Heimbigner 2023-12-20 21:55:34 -06:00 committed by GitHub
parent 937a9c96ce
commit 2a1d16f17b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,66 +92,78 @@ CONFIG_SCHEMA = (
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_PM1, device_class=DEVICE_CLASS_PM1,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_2_5_STD): sensor.sensor_schema( cv.Optional(CONF_PM_2_5_STD): sensor.sensor_schema(
unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER, unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_PM25, device_class=DEVICE_CLASS_PM25,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_10_0_STD): sensor.sensor_schema( cv.Optional(CONF_PM_10_0_STD): sensor.sensor_schema(
unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER, unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_PM10, device_class=DEVICE_CLASS_PM10,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_1_0): sensor.sensor_schema( cv.Optional(CONF_PM_1_0): sensor.sensor_schema(
unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER, unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_PM1,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_2_5): sensor.sensor_schema( cv.Optional(CONF_PM_2_5): sensor.sensor_schema(
unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER, unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_PM25,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_10_0): sensor.sensor_schema( cv.Optional(CONF_PM_10_0): sensor.sensor_schema(
unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER, unit_of_measurement=UNIT_MICROGRAMS_PER_CUBIC_METER,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_PM10,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_0_3UM): sensor.sensor_schema( cv.Optional(CONF_PM_0_3UM): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNT_DECILITRE, unit_of_measurement=UNIT_COUNT_DECILITRE,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_0_5UM): sensor.sensor_schema( cv.Optional(CONF_PM_0_5UM): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNT_DECILITRE, unit_of_measurement=UNIT_COUNT_DECILITRE,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_1_0UM): sensor.sensor_schema( cv.Optional(CONF_PM_1_0UM): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNT_DECILITRE, unit_of_measurement=UNIT_COUNT_DECILITRE,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_2_5UM): sensor.sensor_schema( cv.Optional(CONF_PM_2_5UM): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNT_DECILITRE, unit_of_measurement=UNIT_COUNT_DECILITRE,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_5_0UM): sensor.sensor_schema( cv.Optional(CONF_PM_5_0UM): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNT_DECILITRE, unit_of_measurement=UNIT_COUNT_DECILITRE,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_PM_10_0UM): sensor.sensor_schema( cv.Optional(CONF_PM_10_0UM): sensor.sensor_schema(
unit_of_measurement=UNIT_COUNT_DECILITRE, unit_of_measurement=UNIT_COUNT_DECILITRE,
icon=ICON_CHEMICAL_WEAPON, icon=ICON_CHEMICAL_WEAPON,
accuracy_decimals=0, accuracy_decimals=0,
state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema( cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(
unit_of_measurement=UNIT_CELSIUS, unit_of_measurement=UNIT_CELSIUS,