mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Add roomba total cleaned area sensor (#106640)
* Add roomba total cleaned area sensor * Use parentheses for multi-line lambda * Update homeassistant/components/roomba/sensor.py Co-authored-by: Jan-Philipp Benecke <github@bnck.me> * Update homeassistant/components/roomba/sensor.py Co-authored-by: Jan-Philipp Benecke <github@bnck.me> * Revert "Update homeassistant/components/roomba/sensor.py" This reverts commit 819be6179f140c155687d8916bbe59f3dba9913f. --------- Co-authored-by: Jan-Philipp Benecke <github@bnck.me>
This commit is contained in:
parent
02b863e968
commit
2add7707b4
@ -11,7 +11,12 @@ from homeassistant.components.sensor import (
|
|||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE, EntityCategory, UnitOfTime
|
from homeassistant.const import (
|
||||||
|
AREA_SQUARE_METERS,
|
||||||
|
PERCENTAGE,
|
||||||
|
EntityCategory,
|
||||||
|
UnitOfTime,
|
||||||
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
@ -114,6 +119,20 @@ SENSORS: list[RoombaSensorEntityDescription] = [
|
|||||||
value_fn=lambda self: self.run_stats.get("nScrubs"),
|
value_fn=lambda self: self.run_stats.get("nScrubs"),
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
|
RoombaSensorEntityDescription(
|
||||||
|
key="total_cleaned_area",
|
||||||
|
translation_key="total_cleaned_area",
|
||||||
|
icon="mdi:texture-box",
|
||||||
|
native_unit_of_measurement=AREA_SQUARE_METERS,
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
value_fn=lambda self: (
|
||||||
|
self.run_stats.get("sqft") * 9.29
|
||||||
|
if self.run_stats.get("sqft") is not None
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
suggested_display_precision=0,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +84,9 @@
|
|||||||
},
|
},
|
||||||
"scrubs_count": {
|
"scrubs_count": {
|
||||||
"name": "Scrubs"
|
"name": "Scrubs"
|
||||||
|
},
|
||||||
|
"total_cleaned_area": {
|
||||||
|
"name": "Total cleaned area"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user