Skip to content

q7: narrow decoded command response type#5

Open
arduano wants to merge 1 commit intomainfrom
leo/pr778-postmerge-typing-followup
Open

q7: narrow decoded command response type#5
arduano wants to merge 1 commit intomainfrom
leo/pr778-postmerge-typing-followup

Conversation

@arduano
Copy link
Owner

@arduano arduano commented Mar 15, 2026

Follow-up to upstream PR Python-roborock#778 / Allen's post-merge style nit.

This keeps the existing B01 behavior but narrows send_decoded_command() away from Any to a concrete response alias:

DecodedB01Response = dict[str, object] | str

Why each type exists:

  • dict[str, object]: used for decoded query-style responses where data is structured content, e.g. prop.get, service.get_map_list, and other read/query helpers that parse fields from the returned payload.
  • str: used for raw command ACK responses where the device returns a plain success token like "ok", e.g. action-style commands such as clean/start/pause/stop flows that only need acknowledgement rather than structured data.

The point of this follow-up is to make the return shape more explicit for callers/reviewers without over-constraining it to dict and regressing the existing ACK path.

Validation:

  • ./.venv/bin/pytest -q tests/devices/traits/b01/q7/test_init.py
  • ruff check roborock/devices/rpc/b01_q7_channel.py tests/devices/traits/b01/q7/test_init.py

@arduano arduano force-pushed the leo/pr778-postmerge-typing-followup branch from 43d30a9 to 223fbc5 Compare March 15, 2026 07:28
@arduano arduano force-pushed the leo/pr778-postmerge-typing-followup branch from 223fbc5 to 1ad61a5 Compare March 15, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant