diff --git a/src/sensor_state_data/sensor/device_class.py b/src/sensor_state_data/sensor/device_class.py index f7cb870..afbeabd 100644 --- a/src/sensor_state_data/sensor/device_class.py +++ b/src/sensor_state_data/sensor/device_class.py @@ -18,6 +18,9 @@ class SensorDeviceClass(BaseDeviceClass): # % of battery that is left BATTERY = "battery" + # blood glucose concentration (mg/dL, mmol/L) + BLOOD_GLUCOSE_CONCENTRATION = "blood_glucose_concentration" + # ppm (parts per million) Carbon Monoxide gas concentration CO = "carbon_monoxide" @@ -144,6 +147,9 @@ class SensorDeviceClass(BaseDeviceClass): # signal strength (dB/dBm) SIGNAL_STRENGTH = "signal_strength" + # sound pressure (dB, dBA) + SOUND_PRESSURE = "sound_pressure" + # specific gravity SPECIFIC_GRAVITY = "specific_gravity" @@ -168,6 +174,9 @@ class SensorDeviceClass(BaseDeviceClass): # Amount of VOC (µg/m³) VOLATILE_ORGANIC_COMPOUNDS = "volatile_organic_compounds" + # Ratio of VOC (ppm, ppb) + VOLATILE_ORGANIC_COMPOUNDS_PARTS = "volatile_organic_compounds_parts" + # voltage (V) VOLTAGE = "voltage" diff --git a/tests/test_sensor_device_class_health_air.py b/tests/test_sensor_device_class_health_air.py new file mode 100644 index 0000000..f7013ba --- /dev/null +++ b/tests/test_sensor_device_class_health_air.py @@ -0,0 +1,24 @@ +"""Pin the HA interop string values for recently added sensor device classes. + +These string values are the contract with Home Assistant. They must match HA's +``SensorDeviceClass`` exactly, so drift is caught here rather than downstream. +""" + +from sensor_state_data import SensorDeviceClass + + +def test_blood_glucose_concentration_value(): + assert ( + SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION == "blood_glucose_concentration" + ) + + +def test_sound_pressure_value(): + assert SensorDeviceClass.SOUND_PRESSURE == "sound_pressure" + + +def test_volatile_organic_compounds_parts_value(): + assert ( + SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS_PARTS + == "volatile_organic_compounds_parts" + )