mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Add total cleaning count sensor to Roborock (#135015)
This commit is contained in:
parent
3a213b2d17
commit
0dd9845501
@ -61,6 +61,9 @@
|
||||
"total_cleaning_area": {
|
||||
"default": "mdi:texture-box"
|
||||
},
|
||||
"total_cleaning_count": {
|
||||
"default": "mdi:counter"
|
||||
},
|
||||
"vacuum_error": {
|
||||
"default": "mdi:alert-circle"
|
||||
},
|
||||
|
@ -24,6 +24,7 @@ from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.const import PERCENTAGE, EntityCategory, UnitOfArea, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -112,6 +113,13 @@ SENSOR_DESCRIPTIONS = [
|
||||
value_fn=lambda data: data.clean_summary.clean_time,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
RoborockSensorDescription(
|
||||
key="total_cleaning_count",
|
||||
translation_key="total_cleaning_count",
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
value_fn=lambda data: data.clean_summary.clean_count,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
RoborockSensorDescription(
|
||||
key="status",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
|
@ -228,6 +228,9 @@
|
||||
"total_cleaning_area": {
|
||||
"name": "Total cleaning area"
|
||||
},
|
||||
"total_cleaning_count": {
|
||||
"name": "Total cleaning count"
|
||||
},
|
||||
"vacuum_error": {
|
||||
"name": "Vacuum error",
|
||||
"state": {
|
||||
|
@ -29,7 +29,7 @@ def platforms() -> list[Platform]:
|
||||
|
||||
async def test_sensors(hass: HomeAssistant, setup_entry: MockConfigEntry) -> None:
|
||||
"""Test sensors and check test values are correctly set."""
|
||||
assert len(hass.states.async_all("sensor")) == 38
|
||||
assert len(hass.states.async_all("sensor")) == 40
|
||||
assert hass.states.get("sensor.roborock_s7_maxv_main_brush_time_left").state == str(
|
||||
MAIN_BRUSH_REPLACE_TIME - 74382
|
||||
)
|
||||
@ -54,6 +54,7 @@ async def test_sensors(hass: HomeAssistant, setup_entry: MockConfigEntry) -> Non
|
||||
assert hass.states.get("sensor.roborock_s7_maxv_vacuum_error").state == "none"
|
||||
assert hass.states.get("sensor.roborock_s7_maxv_battery").state == "100"
|
||||
assert hass.states.get("sensor.roborock_s7_maxv_dock_error").state == "ok"
|
||||
assert hass.states.get("sensor.roborock_s7_maxv_total_cleaning_count").state == "31"
|
||||
assert (
|
||||
hass.states.get("sensor.roborock_s7_maxv_last_clean_begin").state
|
||||
== "2023-01-01T03:22:10+00:00"
|
||||
|
Loading…
x
Reference in New Issue
Block a user