Skip to content

fix(v1): decode unrecognized error and status codes as unknown - #1057

Open
hCoureau wants to merge 1 commit into
Python-roborock:mainfrom
hCoureau:submit/fix/unknown-v1-status-codes
Open

hCoureau wants to merge 1 commit into
Python-roborock:mainfrom
hCoureau:submit/fix/unknown-v1-status-codes

Conversation

@hCoureau

@hCoureau hCoureau commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Context

RoborockEnum._missing_ decodes a code the library does not know as the enum's unknown member when it has one, and as the first member otherwise. The enum conformance test keeps a baseline of enums that still lack unknown.

Problem

RoborockErrorCode, RoborockDockErrorCode, RoborockInCleaning, RoborockFinishReason, RoborockCleanType and RoborockStartType have no unknown member, so an unrecognized code is reported as a real value. An unrecognized robot or dock error reads as none/ok, in_cleaning: 4 reads as complete (#929), and finish reason 78 reads as manual_interrupt (#523).

Changes

  • Add unknown = -1 to these six enums and remove them from the conformance baseline.
  • StatusTrait.resolve_error() called without a code skips an unknown dock or robot error, so it never sends -1. This keeps the previous behaviour, where such codes decoded as ok/none and nothing was sent.
  • No named codes are added. RoborockInCleaning is missing code 4 (a298) #929 and Missing RoborockFinishReason code: 78 - defaulting to 21 #523 ask for those; this only stops the codes being misreported.
  • keys() and as_dict() on these enums now include unknown, so consumers that build option lists from them will see the extra value.

Testing

  • New tests for the unknown-code fallback of all six enums. They fail without the enum change, as do the six conformance cases.
  • New tests for resolve_error(): an unknown dock error falls through to the robot error, and nothing is sent when only an unknown error is reported. They fail without the status.py guard.
  • 2,376 tests passed on each of Python 3.11 and 3.14, on current main.
  • pre-commit, commitlint and source/wheel builds passed.

Evidence

  • On a Qrevo 2 Pro (roborock.vacuum.a294, firmware 02.40.54), known codes still decode to their names with this change: error 0, dock error 0, in_cleaning 3, start type 2, clean types 1, 2 and 3, and finish reasons 43, 54 and 56.
  • Decoding an unrecognized code and resolve_error() skipping it use simulated codes only. My device reports no unmapped code, and resolve_error was not sent to it.

Related to #929 and #523.

RoborockErrorCode, RoborockDockErrorCode, RoborockInCleaning,
RoborockFinishReason, RoborockCleanType and RoborockStartType had no
unknown member, so an unrecognized code fell back to the first member:
an unmapped robot or dock error read as none/ok and an unmapped
in_cleaning value as complete. These enums now decode such codes as
unknown, and StatusTrait.resolve_error() without an explicit code skips
an unknown error instead of sending -1.

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

bug Something isn't working Small PR Small pull request (<200 lines) V1 V1 platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants