diff --git a/custom_components/roborock/sensor.py b/custom_components/roborock/sensor.py index 7a83237..555a67c 100644 --- a/custom_components/roborock/sensor.py +++ b/custom_components/roborock/sensor.py @@ -16,7 +16,7 @@ SensorStateClass, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import AREA_SQUARE_METERS, PERCENTAGE, UnitOfTime +from homeassistant.const import UnitOfArea, PERCENTAGE, UnitOfTime from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -100,7 +100,7 @@ class RoborockSensorDescription(SensorEntityDescription): entity_category=EntityCategory.DIAGNOSTIC, ), f"last_clean_{ATTR_LAST_CLEAN_AREA}": RoborockSensorDescription( - native_unit_of_measurement=AREA_SQUARE_METERS, + native_unit_of_measurement=UnitOfArea.SQUARE_METERS, key="area", value=lambda value, _: round(value / 1000000, 1), icon="mdi:texture-box", @@ -130,7 +130,7 @@ class RoborockSensorDescription(SensorEntityDescription): entity_category=EntityCategory.DIAGNOSTIC, ), f"current_{ATTR_STATUS_CLEAN_AREA}": RoborockSensorDescription( - native_unit_of_measurement=AREA_SQUARE_METERS, + native_unit_of_measurement=UnitOfArea.SQUARE_METERS, icon="mdi:texture-box", key="clean_area", value=lambda value, _: round(value / 1000000, 1), @@ -174,7 +174,7 @@ class RoborockSensorDescription(SensorEntityDescription): entity_category=EntityCategory.DIAGNOSTIC, ), f"clean_history_{ATTR_CLEAN_SUMMARY_TOTAL_AREA}": RoborockSensorDescription( - native_unit_of_measurement=AREA_SQUARE_METERS, + native_unit_of_measurement=UnitOfArea.SQUARE_METERS, key="clean_area", value=lambda value, _: round(value / 1000000, 1), icon="mdi:texture-box",