Skip to content

Commit b11fc49

Browse files
authored
fix: Correct reset consumable parameters for strainer and cleaning brush (#879)
1 parent a8a5821 commit b11fc49

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

roborock/devices/traits/v1/consumeable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class ConsumableAttribute(StrEnum):
3030
FILTER_WORK_TIME = "filter_work_time"
3131
SIDE_BRUSH_WORK_TIME = "side_brush_work_time"
3232
MAIN_BRUSH_WORK_TIME = "main_brush_work_time"
33-
STRAINER_WORK_TIME = "strainer_work_time"
34-
CLEANING_BRUSH_WORK_TIME = "cleaning_brush_work_time"
33+
STRAINER_WORK_TIME = "strainer_work_times"
34+
CLEANING_BRUSH_WORK_TIME = "cleaning_brush_work_times"
3535

3636
@classmethod
3737
def from_str(cls, value: str) -> Self:

tests/devices/traits/v1/test_consumable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ async def test_get_consumable_data_success(consumable_trait: ConsumableTrait, mo
5151
(ConsumableAttribute.SIDE_BRUSH_WORK_TIME, "side_brush_work_time"),
5252
(ConsumableAttribute.FILTER_WORK_TIME, "filter_work_time"),
5353
(ConsumableAttribute.SENSOR_DIRTY_TIME, "sensor_dirty_time"),
54-
(ConsumableAttribute.STRAINER_WORK_TIME, "strainer_work_time"),
55-
(ConsumableAttribute.CLEANING_BRUSH_WORK_TIME, "cleaning_brush_work_time"),
54+
(ConsumableAttribute.STRAINER_WORK_TIME, "strainer_work_times"),
55+
(ConsumableAttribute.CLEANING_BRUSH_WORK_TIME, "cleaning_brush_work_times"),
5656
],
5757
)
5858
async def test_reset_consumable_data(

tests/testing/test_v1_simulator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ async def test_trait_consumable_reset():
5353

5454
await device.v1_properties.consumables.refresh()
5555
assert device.v1_properties.consumables.filter_work_time == 74384
56+
assert device.v1_properties.consumables.strainer_work_times == 65
57+
assert device.v1_properties.consumables.cleaning_brush_work_times == 66
5658

5759
# Reset the filter consumable through the trait API
5860
await device.v1_properties.consumables.reset_consumable(ConsumableAttribute.FILTER_WORK_TIME)
@@ -62,6 +64,16 @@ async def test_trait_consumable_reset():
6264
# The trait auto-refreshes after reset, so the client should reflect the change
6365
assert device.v1_properties.consumables.filter_work_time == 0
6466

67+
# Reset the strainer consumable through the trait API
68+
await device.v1_properties.consumables.reset_consumable(ConsumableAttribute.STRAINER_WORK_TIME)
69+
assert fake_device.consumables.strainer_work_times == 0
70+
assert device.v1_properties.consumables.strainer_work_times == 0
71+
72+
# Reset the cleaning brush consumable through the trait API
73+
await device.v1_properties.consumables.reset_consumable(ConsumableAttribute.CLEANING_BRUSH_WORK_TIME)
74+
assert fake_device.consumables.cleaning_brush_work_times == 0
75+
assert device.v1_properties.consumables.cleaning_brush_work_times == 0
76+
6577

6678
async def test_trait_dnd_refresh():
6779
"""Verify that the DND timer trait can be refreshed from the simulator."""

0 commit comments

Comments
 (0)