Skip to content

Commit 806ae85

Browse files
committed
feat(v1): add dock strainer and cleaning brush consumable fields
Callers had to check dock capabilities themselves to know whether a device has a dock strainer or cleaning brush to report and reset. ConsumableField now includes STRAINER_WORK_TIME, supported on docks that wash mops, and CLEANING_BRUSH_WORK_TIME, supported on docks with a cleaning brush, so is_field_supported answers this from the dock type.
1 parent c4609a3 commit 806ae85

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

‎roborock/data/v1/v1_containers.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,15 @@ class ConsumableField(FieldNameBase):
356356
to understand if a feature is supported by the device using `is_field_supported`.
357357
358358
The enum values are names of fields in the `Consumable` class. Each field is
359-
annotated with `dps` metadata to map the field to a `RoborockDataProtocol`
360-
value used to check support against the product schema.
359+
annotated with `dps` metadata (checked against the product schema) or
360+
`dock_feature` metadata (checked against `RoborockDockFeatures`).
361361
"""
362362

363363
MAIN_BRUSH_WORK_TIME = "main_brush_work_time"
364364
SIDE_BRUSH_WORK_TIME = "side_brush_work_time"
365365
FILTER_WORK_TIME = "filter_work_time"
366+
STRAINER_WORK_TIME = "strainer_work_times"
367+
CLEANING_BRUSH_WORK_TIME = "cleaning_brush_work_times"
366368

367369

368370
@dataclass
@@ -372,9 +374,11 @@ class Consumable(RoborockBase):
372374
filter_work_time: int | None = field(default=None, metadata={"dps": RoborockDataProtocol.FILTER_WORK_TIME})
373375
filter_element_work_time: int | None = None
374376
sensor_dirty_time: int | None = None
375-
strainer_work_times: int | None = None
377+
strainer_work_times: int | None = field(default=None, metadata={"dock_feature": "is_washable"})
376378
dust_collection_work_times: int | None = None
377-
cleaning_brush_work_times: int | None = None
379+
cleaning_brush_work_times: int | None = field(
380+
default=None, metadata={"dock_feature": "is_cleaning_brush_supported"}
381+
)
378382
moproller_work_time: int | None = None
379383

380384
@property

‎tests/devices/traits/v1/__snapshots__/test_device_features.ambr‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,64 +181,82 @@
181181
# ---
182182
# name: test_is_consumable_field_supported[home_data_device_p30_pro.json]
183183
dict({
184+
'cleaning_brush_work_times': False,
184185
'filter_work_time': True,
185186
'main_brush_work_time': True,
186187
'side_brush_work_time': True,
188+
'strainer_work_times': True,
187189
})
188190
# ---
189191
# name: test_is_consumable_field_supported[home_data_device_pearls.json]
190192
dict({
193+
'cleaning_brush_work_times': False,
191194
'filter_work_time': True,
192195
'main_brush_work_time': True,
193196
'side_brush_work_time': True,
197+
'strainer_work_times': True,
194198
})
195199
# ---
196200
# name: test_is_consumable_field_supported[home_data_device_q5_max.json]
197201
dict({
202+
'cleaning_brush_work_times': False,
198203
'filter_work_time': True,
199204
'main_brush_work_time': True,
200205
'side_brush_work_time': True,
206+
'strainer_work_times': False,
201207
})
202208
# ---
203209
# name: test_is_consumable_field_supported[home_data_device_q_revo.json]
204210
dict({
211+
'cleaning_brush_work_times': False,
205212
'filter_work_time': True,
206213
'main_brush_work_time': True,
207214
'side_brush_work_time': True,
215+
'strainer_work_times': True,
208216
})
209217
# ---
210218
# name: test_is_consumable_field_supported[home_data_device_qrevo_2_pro.json]
211219
dict({
220+
'cleaning_brush_work_times': False,
212221
'filter_work_time': True,
213222
'main_brush_work_time': True,
214223
'side_brush_work_time': True,
224+
'strainer_work_times': True,
215225
})
216226
# ---
217227
# name: test_is_consumable_field_supported[home_data_device_s5e.json]
218228
dict({
229+
'cleaning_brush_work_times': False,
219230
'filter_work_time': True,
220231
'main_brush_work_time': True,
221232
'side_brush_work_time': True,
233+
'strainer_work_times': False,
222234
})
223235
# ---
224236
# name: test_is_consumable_field_supported[home_data_device_s7_maxv.json]
225237
dict({
238+
'cleaning_brush_work_times': True,
226239
'filter_work_time': True,
227240
'main_brush_work_time': True,
228241
'side_brush_work_time': True,
242+
'strainer_work_times': True,
229243
})
230244
# ---
231245
# name: test_is_consumable_field_supported[home_data_device_saros.json]
232246
dict({
247+
'cleaning_brush_work_times': True,
233248
'filter_work_time': True,
234249
'main_brush_work_time': True,
235250
'side_brush_work_time': True,
251+
'strainer_work_times': True,
236252
})
237253
# ---
238254
# name: test_is_consumable_field_supported[home_data_device_saros_10r.json]
239255
dict({
256+
'cleaning_brush_work_times': True,
240257
'filter_work_time': True,
241258
'main_brush_work_time': True,
242259
'side_brush_work_time': True,
260+
'strainer_work_times': True,
243261
})
244262
# ---

0 commit comments

Comments
 (0)