|
223 | 223 | RoborockZeoProtocol.F_C, # 10001 |
224 | 224 | ] |
225 | 225 |
|
| 226 | +# DPs only answered by models with a softener compartment. |
| 227 | +_SOFTENER_DPS: list[RoborockZeoProtocol] = [ |
| 228 | + RoborockZeoProtocol.SOFTENER_SET, # 212 |
| 229 | + RoborockZeoProtocol.SOFTENER_TYPE, # 214 |
| 230 | + RoborockZeoProtocol.DEFAULT_SETTING, # 225 |
| 231 | + RoborockZeoProtocol.SOFTENER_EMPTY, # 227 |
| 232 | +] |
| 233 | + |
226 | 234 |
|
227 | 235 | # ── Public helpers ────────────────────────────────────────────────────── |
228 | 236 |
|
@@ -259,6 +267,21 @@ def supports_default_setting(model: str | None) -> bool: |
259 | 267 | return model not in _UNSUPPORTED_DEFAULT_SETTING |
260 | 268 |
|
261 | 269 |
|
| 270 | +def supports_dp(model: str | None, dp: RoborockZeoProtocol) -> bool: |
| 271 | + """Return False if *model* is known to never answer a query for *dp*. |
| 272 | +
|
| 273 | + A query only completes once every requested DP is answered, so asking a |
| 274 | + device for a DP it lacks makes the whole query time out. |
| 275 | + """ |
| 276 | + if dp == RoborockZeoProtocol.FEATURE_BITS: |
| 277 | + return supports_feature_bits(model) |
| 278 | + if dp == RoborockZeoProtocol.DEFAULT_SETTING and not supports_default_setting(model): |
| 279 | + return False |
| 280 | + if dp in _SOFTENER_DPS: |
| 281 | + return has_softener_compartment(model) |
| 282 | + return True |
| 283 | + |
| 284 | + |
262 | 285 | def supports_remote_control(model: str | None) -> bool: |
263 | 286 | """Remote control (DP 232) is supported on all overseas models.""" |
264 | 287 | if model is None: |
@@ -291,14 +314,7 @@ def build_force_load_dp_list(model: str | None) -> list[RoborockZeoProtocol]: |
291 | 314 |
|
292 | 315 | # ── Softener block (212, 214, 225, 227) ── |
293 | 316 | if has_softener_compartment(model): |
294 | | - base.extend( |
295 | | - [ |
296 | | - RoborockZeoProtocol.SOFTENER_SET, # 212 |
297 | | - RoborockZeoProtocol.SOFTENER_TYPE, # 214 |
298 | | - RoborockZeoProtocol.DEFAULT_SETTING, # 225 |
299 | | - RoborockZeoProtocol.SOFTENER_EMPTY, # 227 |
300 | | - ] |
301 | | - ) |
| 317 | + base.extend(_SOFTENER_DPS) |
302 | 318 |
|
303 | 319 | # ── Smart-hosting DPs (always queried when FEATURE_BITS is supported) ── |
304 | 320 | if supports_feature_bits(model): |
|
0 commit comments