Repository navigation
Conversation
get_dnd_timer replies can include an actions object (resume, vol, led, dust, dry) that DnDTimer dropped. Keep it as DnDTimerActions with the reported integer values; the timer setters are unchanged.
1afa31b to
6bb585e
Compare
| class DnDTimerActions(RoborockBase): | ||
| """Action flags reported with the DND timer, kept as the raw integers.""" | ||
|
|
||
| resume: int | None = None |
There was a problem hiding this comment.
Can we expose these as booleans?
Lash-L
left a comment
There was a problem hiding this comment.
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
Reviewed 6bb585e. The PR is small and well scoped. It is read-only, the write path (as_list()) is unchanged, and the protocol claims match the Roborock app. The one blocker is the maintainer's open "changes requested" review asking for the flags to be booleans, which has not been addressed yet.
Verdict: Does not pass /review.
Protocol claims checked against the decompiled app (RR_API, Qrevo 2 Pro Series bundle, hermes/no_package/Qrevo 2 Pro Series/output/):
get_dnd_timerreturnsresult[0]withstart_hour/start_minute/end_hour/end_minuteplus a nestedactionsobject. Confirmed:module_3665.js:1427-1449readsr1.result[0], thenactions.resume/vol/led/dust/dry.- The field names are
resume,vol,led,dustanddry. Confirmed:module_3665.js:296(default state) and:462-503(settings list keys). - Their meanings. Confirmed by the strings in
module_1519.jsthat those keys use (localization_strings_Setting_DoNotDisturbPage_3..7):resumeis "Disable Auto Top-up",volis "Quieten Voice Alerts",ledis "Dim Indicator Lights",dustis "Disable Auto Emptying" anddryis "Disable Auto Drying". The docstrings match. - The values are 0/1 (1 means the option is on during DND). Confirmed:
module_3665.js:640-672builds each flag as0or1beforeset_dnd_timer_actions(module_441.js:2991). - The app only parses
actionswhenisSupportCustomDnd()is true (module_3665.js:1431). The PR keeps the field optional and ungated for read-only decoding, which fits the skill's "avoid over-gating telemetry" rule. Nothing to change.
Priority 1: Public Trait APIs & Consumer Contracts
roborock/data/v1/v1_containers.py:285-294: expose the flags asbool | None, not rawint | None(blocking, maintainer request).allenporter's review asks for booleans. With raw ints, every consumer has to write== 1, and the trait leaks the wire encoding through its public API. The ints carry nothing beyond on/off: the app only ever writes0or1.RoborockBase.from_dictalready turns1intoTruefor aboolfield, so no custom parsing is needed:Make the same change for- resume: int | None = None + resume: bool | None = None
vol,led,dustanddry, and update the docstrings ("True when ...") and the expected values intests/devices/traits/v1/test_dnd.py(DnDTimerActions(resume=True, vol=True, ...)). Then update the class docstring "kept as the raw integers" and the commit body to match.
Tests & PR hygiene
- Tests sit in the mirror suite, are parametrized and use the shared
mock_rpc_channelfixture. Nothing to add. - Local run on
6bb585e:pytest2821 passed, 46 xfailed.ruff checkis clean.mypyshows only errors that are already onmainor come from the environment (tests/map/test_b01_q10_render.py:502, plus missing stubs). CI is green, and the PR merges cleanly withmain.
This is an automated review and can be incorrect, so please reply if any finding looks wrong.
What
get_dnd_timerreplies can include anactionsobject with the per-option DND flags (resume,vol,led,dust,dry), butDnDTimerdropped it on parse. This adds:DnDTimerActions(RoborockBase)with the five flags, kept as the rawint | Nonevalues the device reports (1 = option enabled during DND, 0 = disabled).DnDTimer.actions: DnDTimerActions | None = Nonefield, which also surfaces asDoNotDisturbTrait.actions.Why
Consumers can see which DND options are active (quieten voice, dim lights, disable auto-empty and so on) without making a separate request. This is read-only.
set_dnd_timer/enablestill sendas_list()([start_hour, start_minute, end_hour, end_minute]), so the write path is unchanged.Compatibility
The new field is appended last with a
Nonedefault. Existing keyword or positional construction ofDnDTimerstill works, and replies withoutactionsparse toactions=None. The only snapshot change is the extraactions=Nonein theDoNotDisturbTraitrepr.Testing
tests/devices/traits/v1/test_dnd.py: new parametrizedtest_get_dnd_timer_actionsthat refreshes the trait fromget_dnd_timerreplies with several action-flag combinations, plus a reply with noactions. The reply shape follows a Qrevo 2 Pro (roborock.vacuum.a294) response, as noted in the test.sample_dnd_timernow carries actions, so the existingset_dnd_timertest also confirms the flags are left out of the write params.uv run ruff check,uv run ruff format --check,uv run mypy roborock tests(only the existingtests/map/test_b01_q10_render.py:502error, also onmain), anduv run pytest -n auto: 2821 passed, 46 xfailed.🤖 Generated with Claude Code