Skip to content

feat(q7): add set_do_not_disturb trait method#844

Merged
Lash-L merged 2 commits into
Python-roborock:mainfrom
ximex:q7-set-do-not-disturb
Jun 21, 2026
Merged

feat(q7): add set_do_not_disturb trait method#844
Lash-L merged 2 commits into
Python-roborock:mainfrom
ximex:q7-set-do-not-disturb

Conversation

@ximex

@ximex ximex commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds set_do_not_disturb(enabled, begin_time, end_time) to the Q7 (B01) trait.
Part of #739.

Important: this is not a prop.set

Individual prop.set calls for quiet_is_open / quiet_begin_time /
quiet_end_time are ignored by the device. Do-not-disturb must be sent as a
whole via service.set_quiet_time with all three values together (same pattern
as off-peak charging's pv_charging object):

{"is_open": 0, "quiet_begin_time": 1200, "quiet_end_time": 420}

begin_time / end_time are minutes since midnight (verified against the
RR_API docs and the real device, e.g. 1200 -> 20:00, 420 -> 07:00).

Verification

  • Verified live on a Roborock Q7 L5+ (combined command takes effect; individual
    prop writes do not).
  • New parametrized unit test asserting the service.set_quiet_time payload;
    ruff clean.

Copilot AI review requested due to automatic review settings June 3, 2026 22:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Q7 do-not-disturb configuration support by sending the required service.set_quiet_time payload, along with a test to validate the outgoing message shape.

Changes:

  • Added set_do_not_disturb() API method for Q7 that sends service.set_quiet_time with is_open, quiet_begin_time, and quiet_end_time
  • Added a parametrized test covering enabled/disabled do-not-disturb payloads

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/devices/traits/b01/q7/test_init.py Adds coverage verifying correct DND method name and params in the published payload
roborock/devices/traits/b01/q7/init.py Implements DND configuration via a single send() call using the Q7 quiet-time method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +111 to +125
async def set_do_not_disturb(self, enabled: bool, begin_time: int, end_time: int) -> None:
"""Configure do-not-disturb.

The device expects all three values together via ``service.set_quiet_time``
(individual ``prop.set`` calls are ignored). ``begin_time``/``end_time`` are
minutes since midnight.
"""
await self.send(
RoborockB01Q7Methods.SET_QUIET_TIME,
{
"is_open": int(enabled),
"quiet_begin_time": begin_time,
"quiet_end_time": end_time,
},
)

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.

Would be good, but not 100% needed

Comment on lines +155 to +165
@pytest.mark.parametrize("enabled, expected_is_open", [(True, 1), (False, 0)])
async def test_q7_api_set_do_not_disturb(
enabled: bool,
expected_is_open: int,
q7_api: Q7PropertiesApi,
fake_channel: FakeChannel,
message_builder: B01MessageBuilder,
):
"""Test do-not-disturb is set as a whole via service.set_quiet_time."""
fake_channel.response_queue.append(message_builder.build({"result": "ok"}))
await q7_api.set_do_not_disturb(enabled, 1200, 420)
@Lash-L Lash-L marked this pull request as draft June 3, 2026 23:52
@Lash-L Lash-L marked this pull request as ready for review June 20, 2026 18:39
@Lash-L

Lash-L commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

@ximex one comment here that may be worthwhile. Can you fix conflicts here too?

ximex and others added 2 commits June 21, 2026 17:52
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Validate begin_time/end_time are within 0-1439 minutes since midnight and
raise a clear ValueError when out of bounds. Clarify in the docstring that
cross-midnight ranges are supported via begin_time > end_time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ximex ximex force-pushed the q7-set-do-not-disturb branch from 55ffd58 to 402d2a5 Compare June 21, 2026 15:53
@ximex ximex requested a review from Lash-L June 21, 2026 15:54
@Lash-L Lash-L merged commit 3bbf72e into Python-roborock:main Jun 21, 2026
7 checks passed
@ximex ximex deleted the q7-set-do-not-disturb branch June 21, 2026 19:05
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.

3 participants