diff --git a/homeassistant/components/roborock/icons.json b/homeassistant/components/roborock/icons.json index 15414cfc2d9..6a96b04e12e 100644 --- a/homeassistant/components/roborock/icons.json +++ b/homeassistant/components/roborock/icons.json @@ -61,6 +61,9 @@ "total_cleaning_area": { "default": "mdi:texture-box" }, + "total_cleaning_count": { + "default": "mdi:counter" + }, "vacuum_error": { "default": "mdi:alert-circle" }, diff --git a/homeassistant/components/roborock/sensor.py b/homeassistant/components/roborock/sensor.py index 47849ed5cc5..e01a03d7720 100644 --- a/homeassistant/components/roborock/sensor.py +++ b/homeassistant/components/roborock/sensor.py @@ -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, diff --git a/homeassistant/components/roborock/strings.json b/homeassistant/components/roborock/strings.json index 6e68ab80453..7005344614c 100644 --- a/homeassistant/components/roborock/strings.json +++ b/homeassistant/components/roborock/strings.json @@ -228,6 +228,9 @@ "total_cleaning_area": { "name": "Total cleaning area" }, + "total_cleaning_count": { + "name": "Total cleaning count" + }, "vacuum_error": { "name": "Vacuum error", "state": { diff --git a/tests/components/roborock/test_sensor.py b/tests/components/roborock/test_sensor.py index 9421f59ee56..e33d3aa78d5 100644 --- a/tests/components/roborock/test_sensor.py +++ b/tests/components/roborock/test_sensor.py @@ -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"