diff --git a/homeassistant/components/litterrobot/sensor.py b/homeassistant/components/litterrobot/sensor.py index ab87df88bbe..3b994f4ae9d 100644 --- a/homeassistant/components/litterrobot/sensor.py +++ b/homeassistant/components/litterrobot/sensor.py @@ -16,7 +16,7 @@ from homeassistant.components.sensor import ( SensorStateClass, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import MASS_POUNDS, PERCENTAGE +from homeassistant.const import PERCENTAGE, UnitOfMass from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -140,7 +140,7 @@ ROBOT_SENSOR_MAP: dict[type[Robot], list[RobotSensorEntityDescription]] = { RobotSensorEntityDescription[LitterRobot4]( key="pet_weight", name="Pet weight", - native_unit_of_measurement=MASS_POUNDS, + native_unit_of_measurement=UnitOfMass.POUNDS, device_class=SensorDeviceClass.WEIGHT, state_class=SensorStateClass.MEASUREMENT, ), diff --git a/homeassistant/components/omnilogic/sensor.py b/homeassistant/components/omnilogic/sensor.py index ba661c8cbd5..d072cc3d9bd 100644 --- a/homeassistant/components/omnilogic/sensor.py +++ b/homeassistant/components/omnilogic/sensor.py @@ -6,10 +6,10 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, ELECTRIC_POTENTIAL_MILLIVOLT, - MASS_GRAMS, PERCENTAGE, TEMP_CELSIUS, TEMP_FAHRENHEIT, + UnitOfMass, UnitOfVolume, ) from homeassistant.core import HomeAssistant @@ -174,7 +174,7 @@ class OmniLogicSaltLevelSensor(OmnilogicSensor): if self._unit_type == "Metric": salt_return = round(int(salt_return) / 1000, 2) - unit_of_measurement = f"{MASS_GRAMS}/{UnitOfVolume.LITERS}" + unit_of_measurement = f"{UnitOfMass.GRAMS}/{UnitOfVolume.LITERS}" self._unit = unit_of_measurement diff --git a/homeassistant/components/tasmota/sensor.py b/homeassistant/components/tasmota/sensor.py index a2715e0b7ed..282ea69d272 100644 --- a/homeassistant/components/tasmota/sensor.py +++ b/homeassistant/components/tasmota/sensor.py @@ -24,7 +24,6 @@ from homeassistant.const import ( ENERGY_KILO_WATT_HOUR, LENGTH_CENTIMETERS, LIGHT_LUX, - MASS_KILOGRAMS, PERCENTAGE, PRESSURE_HPA, SIGNAL_STRENGTH_DECIBELS, @@ -37,6 +36,7 @@ from homeassistant.const import ( TEMP_KELVIN, UnitOfApparentPower, UnitOfFrequency, + UnitOfMass, UnitOfPower, ) from homeassistant.core import HomeAssistant, callback @@ -219,7 +219,7 @@ SENSOR_UNIT_MAP = { hc.FREQUENCY_HERTZ: UnitOfFrequency.HERTZ, hc.LENGTH_CENTIMETERS: LENGTH_CENTIMETERS, hc.LIGHT_LUX: LIGHT_LUX, - hc.MASS_KILOGRAMS: MASS_KILOGRAMS, + hc.MASS_KILOGRAMS: UnitOfMass.KILOGRAMS, hc.PERCENTAGE: PERCENTAGE, hc.POWER_WATT: UnitOfPower.WATT, hc.PRESSURE_HPA: PRESSURE_HPA, diff --git a/homeassistant/components/watttime/sensor.py b/homeassistant/components/watttime/sensor.py index 040753d97e8..c8e9a376fdc 100644 --- a/homeassistant/components/watttime/sensor.py +++ b/homeassistant/components/watttime/sensor.py @@ -10,7 +10,7 @@ from homeassistant.components.sensor import ( SensorStateClass, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, MASS_POUNDS, PERCENTAGE +from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, PERCENTAGE, UnitOfMass from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import StateType @@ -37,7 +37,7 @@ REALTIME_EMISSIONS_SENSOR_DESCRIPTIONS = ( key=SENSOR_TYPE_REALTIME_EMISSIONS_MOER, name="Marginal operating emissions rate", icon="mdi:blur", - native_unit_of_measurement=f"{MASS_POUNDS} CO2/MWh", + native_unit_of_measurement=f"{UnitOfMass.POUNDS} CO2/MWh", state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription(