From 002304a109fe8ef3b82f473eb08548bc01ccfea1 Mon Sep 17 00:00:00 2001 From: Bluetooth Devices Bot Date: Mon, 22 Jun 2026 23:54:46 +0000 Subject: [PATCH 1/2] feat: add blood glucose, sound pressure, VOC parts device classes Add three Home Assistant SensorDeviceClass members that were missing from the mirror: BLOOD_GLUCOSE_CONCENTRATION, SOUND_PRESSURE, and VOLATILE_ORGANIC_COMPOUNDS_PARTS. All three are common BLE sensor readings (glucose meters, noise sensors, ppb-scale VOC). Values match HA exactly. Pin the interop string values with a regression test. --- src/sensor_state_data/sensor/device_class.py | 9 ++++++++ tests/test_sensor_device_class_health_air.py | 22 ++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/test_sensor_device_class_health_air.py 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..01e5e1d --- /dev/null +++ b/tests/test_sensor_device_class_health_air.py @@ -0,0 +1,22 @@ +"""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" + ) From a748dd60fc4e64073a3e9d4881fedea8e9e29211 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2026 23:55:19 +0000 Subject: [PATCH 2/2] chore(pre-commit.ci): auto fixes --- tests/test_sensor_device_class_health_air.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_sensor_device_class_health_air.py b/tests/test_sensor_device_class_health_air.py index 01e5e1d..f7013ba 100644 --- a/tests/test_sensor_device_class_health_air.py +++ b/tests/test_sensor_device_class_health_air.py @@ -8,7 +8,9 @@ def test_blood_glucose_concentration_value(): - assert SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION == "blood_glucose_concentration" + assert ( + SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION == "blood_glucose_concentration" + ) def test_sound_pressure_value():