Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Oct 31, 2024
1 parent 729cee9 commit 604d6cf
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/nightscout/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/number/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/number/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"battery": {
"default": "mdi:battery"
},
"blood_glucose_concentration": {
"default": "mdi:spoon-sugar"
},
"carbon_dioxide": {
"default": "mdi:molecule-co2"
},
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/number/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%]"
},
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/sensor/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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},
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/sensor/device_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}],
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/sensor/device_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}],
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/sensor/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"atmospheric_pressure": {
"default": "mdi:thermometer-lines"
},
"blood_sugar_level": {
"blood_glucose_concentration": {
"default": "mdi:spoon-sugar"
},
"carbon_dioxide": {
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/sensor/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -151,7 +151,7 @@
"battery": {
"name": "Battery"
},
"blood_sugar_level": {
"blood_glucose_concentration": {
"name": "Blood sugar level"
},
"carbon_monoxide": {
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/util/unit_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 604d6cf

Please sign in to comment.