From 604d6cf30724cd594073b3b1eb5eecfe4510872e Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:06:14 +0000 Subject: [PATCH] Rename --- homeassistant/components/nightscout/sensor.py | 2 +- homeassistant/components/number/const.py | 4 ++-- homeassistant/components/number/icons.json | 3 +++ homeassistant/components/number/strings.json | 3 +++ homeassistant/components/sensor/const.py | 8 ++++---- homeassistant/components/sensor/device_condition.py | 8 +++++--- homeassistant/components/sensor/device_trigger.py | 8 +++++--- homeassistant/components/sensor/icons.json | 2 +- homeassistant/components/sensor/strings.json | 6 +++--- homeassistant/util/unit_conversion.py | 2 +- 10 files changed, 28 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/nightscout/sensor.py b/homeassistant/components/nightscout/sensor.py index b965644ede8e4..620349ec3c3ff 100644 --- a/homeassistant/components/nightscout/sensor.py +++ b/homeassistant/components/nightscout/sensor.py @@ -37,7 +37,7 @@ async def async_setup_entry( class NightscoutSensor(SensorEntity): """Implementation of a Nightscout sensor.""" - _attr_device_class = SensorDeviceClass.BLOOD_SUGAR_LEVEL + _attr_device_class = SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION _attr_native_unit_of_measurement = ( UnitOfBloodGlucoseConcentration.MILLIGRAMS_PER_DECILITER ) diff --git a/homeassistant/components/number/const.py b/homeassistant/components/number/const.py index 28cedc3d25886..b07231845c1b3 100644 --- a/homeassistant/components/number/const.py +++ b/homeassistant/components/number/const.py @@ -110,7 +110,7 @@ class NumberDeviceClass(StrEnum): Unit of measurement: `%` """ - BLOOD_SUGAR_LEVEL = "blood_sugar_level" + BLOOD_GLUCOSE_CONCENTRATION = "blood_glucose_concentration" """Blood sugar level. Unit of measurement: `mg/dL`, `mmol/L` @@ -436,7 +436,7 @@ class NumberDeviceClass(StrEnum): NumberDeviceClass.AQI: {None}, NumberDeviceClass.ATMOSPHERIC_PRESSURE: set(UnitOfPressure), NumberDeviceClass.BATTERY: {PERCENTAGE}, - NumberDeviceClass.BLOOD_SUGAR_LEVEL: set(UnitOfBloodGlucoseConcentration), + NumberDeviceClass.BLOOD_GLUCOSE_CONCENTRATION: set(UnitOfBloodGlucoseConcentration), NumberDeviceClass.CO: {CONCENTRATION_PARTS_PER_MILLION}, NumberDeviceClass.CO2: {CONCENTRATION_PARTS_PER_MILLION}, NumberDeviceClass.CONDUCTIVITY: set(UnitOfConductivity), diff --git a/homeassistant/components/number/icons.json b/homeassistant/components/number/icons.json index a122aaecb0946..5e0fc6e44d261 100644 --- a/homeassistant/components/number/icons.json +++ b/homeassistant/components/number/icons.json @@ -15,6 +15,9 @@ "battery": { "default": "mdi:battery" }, + "blood_glucose_concentration": { + "default": "mdi:spoon-sugar" + }, "carbon_dioxide": { "default": "mdi:molecule-co2" }, diff --git a/homeassistant/components/number/strings.json b/homeassistant/components/number/strings.json index 580385172e38a..b9aec880ecc22 100644 --- a/homeassistant/components/number/strings.json +++ b/homeassistant/components/number/strings.json @@ -43,6 +43,9 @@ "battery": { "name": "[%key:component::sensor::entity_component::battery::name%]" }, + "blood_glucose_concentration": { + "name": "[%key:component::sensor::entity_component::blood_glucose_concentration::name%]" + }, "carbon_dioxide": { "name": "[%key:component::sensor::entity_component::carbon_dioxide::name%]" }, diff --git a/homeassistant/components/sensor/const.py b/homeassistant/components/sensor/const.py index 3d4963fbd7ad5..1d920f38d574c 100644 --- a/homeassistant/components/sensor/const.py +++ b/homeassistant/components/sensor/const.py @@ -129,7 +129,7 @@ class SensorDeviceClass(StrEnum): Unit of measurement: `%` """ - BLOOD_SUGAR_LEVEL = "blood_sugar_level" + BLOOD_GLUCOSE_CONCENTRATION = "blood_glucose_concentration" """Blood sugar level. Unit of measurement: `mg/dL`, `mmol/L` @@ -501,7 +501,7 @@ class SensorStateClass(StrEnum): UNIT_CONVERTERS: dict[SensorDeviceClass | str | None, type[BaseUnitConverter]] = { SensorDeviceClass.ATMOSPHERIC_PRESSURE: PressureConverter, - SensorDeviceClass.BLOOD_SUGAR_LEVEL: BloodSugarLevelConverter, + SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION: BloodSugarLevelConverter, SensorDeviceClass.CONDUCTIVITY: ConductivityConverter, SensorDeviceClass.CURRENT: ElectricCurrentConverter, SensorDeviceClass.DATA_RATE: DataRateConverter, @@ -533,7 +533,7 @@ class SensorStateClass(StrEnum): SensorDeviceClass.AQI: {None}, SensorDeviceClass.ATMOSPHERIC_PRESSURE: set(UnitOfPressure), SensorDeviceClass.BATTERY: {PERCENTAGE}, - SensorDeviceClass.BLOOD_SUGAR_LEVEL: set(UnitOfBloodGlucoseConcentration), + SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION: set(UnitOfBloodGlucoseConcentration), SensorDeviceClass.CO: {CONCENTRATION_PARTS_PER_MILLION}, SensorDeviceClass.CO2: {CONCENTRATION_PARTS_PER_MILLION}, SensorDeviceClass.CONDUCTIVITY: set(UnitOfConductivity), @@ -609,7 +609,7 @@ class SensorStateClass(StrEnum): SensorDeviceClass.AQI: {SensorStateClass.MEASUREMENT}, SensorDeviceClass.ATMOSPHERIC_PRESSURE: {SensorStateClass.MEASUREMENT}, SensorDeviceClass.BATTERY: {SensorStateClass.MEASUREMENT}, - SensorDeviceClass.BLOOD_SUGAR_LEVEL: {SensorStateClass.MEASUREMENT}, + SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION: {SensorStateClass.MEASUREMENT}, SensorDeviceClass.CO: {SensorStateClass.MEASUREMENT}, SensorDeviceClass.CO2: {SensorStateClass.MEASUREMENT}, SensorDeviceClass.CONDUCTIVITY: {SensorStateClass.MEASUREMENT}, diff --git a/homeassistant/components/sensor/device_condition.py b/homeassistant/components/sensor/device_condition.py index 02cea835c0f52..56ecb36adb3b1 100644 --- a/homeassistant/components/sensor/device_condition.py +++ b/homeassistant/components/sensor/device_condition.py @@ -37,7 +37,7 @@ CONF_IS_AQI = "is_aqi" CONF_IS_ATMOSPHERIC_PRESSURE = "is_atmospheric_pressure" CONF_IS_BATTERY_LEVEL = "is_battery_level" -CONF_IS_BLOOD_SUGAR_LEVEL = "is_blood_sugar_level" +CONF_IS_BLOOD_GLUCOSE_CONCENTRATION = "is_blood_glucose_concentration" CONF_IS_CO = "is_carbon_monoxide" CONF_IS_CO2 = "is_carbon_dioxide" CONF_IS_CONDUCTIVITY = "is_conductivity" @@ -88,7 +88,9 @@ SensorDeviceClass.AQI: [{CONF_TYPE: CONF_IS_AQI}], SensorDeviceClass.ATMOSPHERIC_PRESSURE: [{CONF_TYPE: CONF_IS_ATMOSPHERIC_PRESSURE}], SensorDeviceClass.BATTERY: [{CONF_TYPE: CONF_IS_BATTERY_LEVEL}], - SensorDeviceClass.BLOOD_SUGAR_LEVEL: [{CONF_TYPE: CONF_IS_BLOOD_SUGAR_LEVEL}], + SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION: [ + {CONF_TYPE: CONF_IS_BLOOD_GLUCOSE_CONCENTRATION} + ], SensorDeviceClass.CO: [{CONF_TYPE: CONF_IS_CO}], SensorDeviceClass.CO2: [{CONF_TYPE: CONF_IS_CO2}], SensorDeviceClass.CONDUCTIVITY: [{CONF_TYPE: CONF_IS_CONDUCTIVITY}], @@ -153,7 +155,7 @@ CONF_IS_AQI, CONF_IS_ATMOSPHERIC_PRESSURE, CONF_IS_BATTERY_LEVEL, - CONF_IS_BLOOD_SUGAR_LEVEL, + CONF_IS_BLOOD_GLUCOSE_CONCENTRATION, CONF_IS_CO, CONF_IS_CO2, CONF_IS_CONDUCTIVITY, diff --git a/homeassistant/components/sensor/device_trigger.py b/homeassistant/components/sensor/device_trigger.py index 22e0aad9d132a..ffee10d9f401b 100644 --- a/homeassistant/components/sensor/device_trigger.py +++ b/homeassistant/components/sensor/device_trigger.py @@ -36,7 +36,7 @@ CONF_AQI = "aqi" CONF_ATMOSPHERIC_PRESSURE = "atmospheric_pressure" CONF_BATTERY_LEVEL = "battery_level" -CONF_BLOOD_SUGAR_LEVEL = "blood_sugar_level" +CONF_BLOOD_GLUCOSE_CONCENTRATION = "blood_glucose_concentration" CONF_CO = "carbon_monoxide" CONF_CO2 = "carbon_dioxide" CONF_CONDUCTIVITY = "conductivity" @@ -87,7 +87,9 @@ SensorDeviceClass.AQI: [{CONF_TYPE: CONF_AQI}], SensorDeviceClass.ATMOSPHERIC_PRESSURE: [{CONF_TYPE: CONF_ATMOSPHERIC_PRESSURE}], SensorDeviceClass.BATTERY: [{CONF_TYPE: CONF_BATTERY_LEVEL}], - SensorDeviceClass.BLOOD_SUGAR_LEVEL: [{CONF_TYPE: CONF_BLOOD_SUGAR_LEVEL}], + SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION: [ + {CONF_TYPE: CONF_BLOOD_GLUCOSE_CONCENTRATION} + ], SensorDeviceClass.CO: [{CONF_TYPE: CONF_CO}], SensorDeviceClass.CO2: [{CONF_TYPE: CONF_CO2}], SensorDeviceClass.CONDUCTIVITY: [{CONF_TYPE: CONF_CONDUCTIVITY}], @@ -153,7 +155,7 @@ CONF_AQI, CONF_ATMOSPHERIC_PRESSURE, CONF_BATTERY_LEVEL, - CONF_BLOOD_SUGAR_LEVEL, + CONF_BLOOD_GLUCOSE_CONCENTRATION, CONF_CO, CONF_CO2, CONF_CONDUCTIVITY, diff --git a/homeassistant/components/sensor/icons.json b/homeassistant/components/sensor/icons.json index a377501905d09..ea4c902e66573 100644 --- a/homeassistant/components/sensor/icons.json +++ b/homeassistant/components/sensor/icons.json @@ -12,7 +12,7 @@ "atmospheric_pressure": { "default": "mdi:thermometer-lines" }, - "blood_sugar_level": { + "blood_glucose_concentration": { "default": "mdi:spoon-sugar" }, "carbon_dioxide": { diff --git a/homeassistant/components/sensor/strings.json b/homeassistant/components/sensor/strings.json index a4d9bebc22365..64fc1c1eabb9f 100644 --- a/homeassistant/components/sensor/strings.json +++ b/homeassistant/components/sensor/strings.json @@ -6,7 +6,7 @@ "is_aqi": "Current {entity_name} air quality index", "is_atmospheric_pressure": "Current {entity_name} atmospheric pressure", "is_battery_level": "Current {entity_name} battery level", - "is_blood_sugar_level": "Current {entity_name} blood sugar level", + "is_blood_glucose_concentration": "Current {entity_name} blood sugar level", "is_carbon_monoxide": "Current {entity_name} carbon monoxide concentration level", "is_carbon_dioxide": "Current {entity_name} carbon dioxide concentration level", "is_conductivity": "Current {entity_name} conductivity", @@ -57,7 +57,7 @@ "aqi": "{entity_name} air quality index changes", "atmospheric_pressure": "{entity_name} atmospheric pressure changes", "battery_level": "{entity_name} battery level changes", - "blood_sugar_level": "{entity_name} blood sugar level changes", + "blood_glucose_concentration": "{entity_name} blood sugar level changes", "carbon_monoxide": "{entity_name} carbon monoxide concentration changes", "carbon_dioxide": "{entity_name} carbon dioxide concentration changes", "conductivity": "{entity_name} conductivity changes", @@ -151,7 +151,7 @@ "battery": { "name": "Battery" }, - "blood_sugar_level": { + "blood_glucose_concentration": { "name": "Blood sugar level" }, "carbon_monoxide": { diff --git a/homeassistant/util/unit_conversion.py b/homeassistant/util/unit_conversion.py index b235345a22b1b..7a6831cec7e40 100644 --- a/homeassistant/util/unit_conversion.py +++ b/homeassistant/util/unit_conversion.py @@ -177,7 +177,7 @@ class DistanceConverter(BaseUnitConverter): class BloodSugarLevelConverter(BaseUnitConverter): """Utility to convert blood sugar level values.""" - UNIT_CLASS = "blood_sugar_level" + UNIT_CLASS = "blood_glucose_concentration" _UNIT_CONVERSION: dict[str | None, float] = { UnitOfBloodGlucoseConcentration.MILLIGRAMS_PER_DECILITER: 18, UnitOfBloodGlucoseConcentration.MILLIMOLS_PER_LITER: 1,