diff --git a/homeassistant/components/roborock/coordinator.py b/homeassistant/components/roborock/coordinator.py index e20670706c96e..f35ea03660930 100644 --- a/homeassistant/components/roborock/coordinator.py +++ b/homeassistant/components/roborock/coordinator.py @@ -550,6 +550,7 @@ def __init__( RoborockB01Props.WIND, RoborockB01Props.WATER, RoborockB01Props.MODE, + RoborockB01Props.QUANTITY, ] async def _async_update_data( diff --git a/homeassistant/components/roborock/sensor.py b/homeassistant/components/roborock/sensor.py index bb0240a78da14..cbe634dce9b27 100644 --- a/homeassistant/components/roborock/sensor.py +++ b/homeassistant/components/roborock/sensor.py @@ -366,6 +366,13 @@ def _dock_error_value_fn(state: DeviceState) -> str | None: translation_key="main_brush_time_left", entity_category=EntityCategory.DIAGNOSTIC, ), + RoborockSensorDescriptionB01( + key="battery", + value_fn=lambda data: data.battery, + device_class=SensorDeviceClass.BATTERY, + native_unit_of_measurement=PERCENTAGE, + entity_category=EntityCategory.DIAGNOSTIC, + ), RoborockSensorDescriptionB01( key="side_brush_time_left", value_fn=lambda data: data.side_brush_time_left, diff --git a/tests/components/roborock/mock_data.py b/tests/components/roborock/mock_data.py index 63258a7c0f155..f55c6dbec30f8 100644 --- a/tests/components/roborock/mock_data.py +++ b/tests/components/roborock/mock_data.py @@ -1564,6 +1564,7 @@ main_sensor=500, mop_life=1200, real_clean_time=3000, + quantity=100, ) Q10_STATUS = Q10Status( diff --git a/tests/components/roborock/snapshots/test_sensor.ambr b/tests/components/roborock/snapshots/test_sensor.ambr index d0a92bb7bfc05..0d9b0829ccaa6 100644 --- a/tests/components/roborock/snapshots/test_sensor.ambr +++ b/tests/components/roborock/snapshots/test_sensor.ambr @@ -407,6 +407,58 @@ 'state': '3.55', }) # --- +# name: test_sensors[sensor.roborock_q7_battery-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.roborock_q7_battery', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Battery', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Battery', + 'platform': 'roborock', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'battery_q7_duid', + 'unit_of_measurement': '%', + }) +# --- +# name: test_sensors[sensor.roborock_q7_battery-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'battery', + 'friendly_name': 'Roborock Q7 Battery', + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.roborock_q7_battery', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '100', + }) +# --- # name: test_sensors[sensor.roborock_q7_filter_time_left-entry] EntityRegistryEntrySnapshot({ 'aliases': list([