Skip to content

fix(a01): return partial query responses - #1080

Open
hCoureau wants to merge 1 commit into
Python-roborock:mainfrom
hCoureau:submit/fix/a01-partial-query-response
Open

hCoureau wants to merge 1 commit into
Python-roborock:mainfrom
hCoureau:submit/fix/a01-partial-query-response

Conversation

@hCoureau

Copy link
Copy Markdown
Contributor

Problem

The Zeo Mini (roborock.wm.a93) can return state and remaining time while omitting the two softener data points requested by the periodic poll. The library currently waits 10 seconds for the remaining values, then discards the values it received. This is the failure reported in #1013.

Changes

If at least one requested data point arrived by the deadline, return the accumulated values and record the query as an MQTT success. The deadline is unchanged, and a query that receives none of its requested values still times out. query_values() reports missing values as None, and Zeo retains its known feature bits when the query omits them.

Testing

  • Regression tests cover partial replies, missing Dyad values and Zeo feature state on initial refresh and after restart.
  • 2,685 tests passed on each of Python 3.11 and 3.14 against upstream 321c6d5. The default suite excludes the 11 real-broker tests.
  • Pre-commit, commitlint, and source and wheel builds passed.

A01 devices may never report data points they do not support, such as
the softener data points on the Zeo Mini. A query waited for every
requested data point, so it timed out, discarded the values that did
arrive and counted a timeout against the MQTT session.

If some requested data points arrived before the timeout, the query now
returns them and counts as a success; with none it still raises.
query_values reports an unreported data point as None, and Zeo keeps
its known feature bits when FEATURE_BITS is not reported.
@Lash-L

Lash-L commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Hi @hCoureau! Consider joining our Roborock contributor discord to stay in touch and have easier access to us! https://discord.gg/8ytF2t5F

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated code review by Claude Opus 5.5 in Claude Code using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).

Summary

Verdict: Passes /review with nits.

#1080 changes send_decoded_command so that a query which times out with some requested data points returns them and records an MQTT success. A query that gets none still raises and calls on_timeout(). Dyad and Zeo query_values() now return None for data points the device never sent, instead of running the converter on None. Before, bool(None) turned a missing DETERGENT_EMPTY/SOFTENER_EMPTY into False, so this also fixes a quiet bug. ZeoApi._load_force_dps keeps its known feature bits when DP 237 is missing instead of resetting them to 0. The change is small and clearly scoped, and it fixes the failure in #1013: the values that do arrive are no longer thrown away, and the MQTT session no longer gets timeout strikes that restart it.

Checked against the app: the Zeo bundle (RR_API/nonhermes/com.roborock.wm/Zeo One/index.android.bundle:783, publishDp) registers its callback on the first DP in the 10000 query param (JSON.parse(e.param)[0]). It resolves on the first message that contains that DP and never waits for the full set (default timeout 10 s, and 3 s for forceLoadDps). So the library's "wait for every requested DP" rule is stricter than the app's, and accepting a partial reply is consistent with how the app behaves. Confirmed.

Priority 2: Lifecycle, State & Concurrency

  1. roborock/devices/rpc/a01_channel.py:103-113: every partial query still takes the full 10 s (non-blocking design question). The partial result only comes back after asyncio.wait_for(..., _TIMEOUT) expires. On a Zeo Mini (roborock.wm.a93), every periodic poll that includes the softener DPs (214/227) therefore blocks for 10 s before the coordinator gets data. The entities stay available, but each update is slow, and a device that always omits a DP pays this cost on every poll. Two ways to reduce it:
    • Pair this with #1090, which stops requesting DPs the model is known not to support, so known models never reach the timeout path. This PR remains the fallback for unknown models and firmware (see below).
    • Or follow the app and finish soon after the first reply that contains requested DPs, for example with a short grace window after the first matching message instead of the full _TIMEOUT. That is a larger change to the merge-across-messages logic, so it is probably better as a follow-up than as part of this PR.

Overlap with #1090 ("fix(a01): skip unsupported DPs in Zeo query_values")

  • Complementary, not duplicates. #1090 filters the request with a new supports_dp(model, dp) helper (the softener block, DP 225 and DP 237 gates in device_feature.py). roborock.wm.a93 is in _M1_SERIES, so has_softener_compartment() returns False for it and the softener DPs are never sent. That avoids the 10 s wait, but it only covers Zeo models already in the gate tables: an unlisted model or a firmware that drops a DP still times out completely. This PR is the general safety net, and it covers Dyad as well. The best result is to merge both: #1090 for latency on known models, #1080 for resilience.
  • Textual conflict: git merge-tree reports a content conflict in roborock/devices/traits/a01/__init__.py in ZeoApi.query_values, where both PRs rewrite the same lines. Both use the same values = {... if protocol in response else None ...} comprehension, so resolving it is trivial: keep #1090's supported filtering and the shared comprehension. Whichever PR lands second needs a rebase. There are no semantic conflicts. With both merged, a query made up only of unsupported DPs sends nothing (#1090), and a query that still gets a partial reply returns the subset (#1080).

Tests & PR hygiene

  • The tests sit in the mirror paths (tests/devices/rpc/test_a01_channel.py, tests/devices/traits/a01/test_init.py). They use the shared fake_channel / mock_mqtt_channel fixtures and assert public behaviour: return values, values, supports() and the published payloads. The restart test also checks that the second-stage feature query still goes out ({"10000": "[244]"}).
  • The PR is based on 7.28.0 and merges cleanly with the current main.
  • Local run on the PR head (Python 3.13): pytest 2685 passed, 11 deselected, 47 xfailed. ruff check is clean. Local mypy reports one error in tests/map/test_b01_q10_render.py:502, a file this PR does not touch; CI lint is green, so the error comes from the local environment. All CI checks are green.

This is an automated review and can be incorrect, so please reply if any finding looks wrong.

@Lash-L Lash-L added /review run Code review skill (/review) has been run Passed /review Passed the /review skill check labels Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Passed /review Passed the /review skill check /review run Code review skill (/review) has been run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants