feat(q7): add set_do_not_disturb trait method#844
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 sendsservice.set_quiet_timewithis_open,quiet_begin_time, andquiet_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, | ||
| }, | ||
| ) |
Collaborator
There was a problem hiding this comment.
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) |
Collaborator
|
@ximex one comment here that may be worthwhile. Can you fix conflicts here too? |
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>
55ffd58 to
402d2a5
Compare
Lash-L
approved these changes
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.setIndividual
prop.setcalls forquiet_is_open/quiet_begin_time/quiet_end_timeare ignored by the device. Do-not-disturb must be sent as awhole via
service.set_quiet_timewith all three values together (same patternas off-peak charging's
pv_chargingobject):{"is_open": 0, "quiet_begin_time": 1200, "quiet_end_time": 420}begin_time/end_timeare minutes since midnight (verified against theRR_API docs and the real device, e.g.
1200-> 20:00,420-> 07:00).Verification
prop writes do not).
service.set_quiet_timepayload;ruffclean.