Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Area_square_meters deprecation #679

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions custom_components/roborock/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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",
Expand Down