Add quietdrift (quiet mode) support for roller shades#456
Open
sjafferali wants to merge 1 commit intosblibs:masterfrom
Open
Add quietdrift (quiet mode) support for roller shades#456sjafferali wants to merge 1 commit intosblibs:masterfrom
sjafferali wants to merge 1 commit intosblibs:masterfrom
Conversation
The open(), close(), and set_position() methods now accept a mode parameter (0 = performance, 1 = quiet) that controls motor speed. Previously open() and close() ignored the mode parameter and always sent hardcoded performance-mode commands.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds “quietdrift” (quiet mode) support to Switchbot Roller Shade command generation so open(), close(), and set_position() can encode the requested motor mode into the BLE payload.
Changes:
- Update Roller Shade
open()/close()to build the second command dynamically using the providedmode. - Adjust Roller Shade command constants to use a shared base prefix for the second command.
- Expand unit tests to cover default vs quiet mode for
open(),close(), andset_position().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
switchbot/devices/roller_shade.py |
Builds open/close command payloads using the provided mode rather than hardcoding performance mode. |
tests/test_roller_shade.py |
Adds/updates tests asserting the correct command bytes are sent for performance vs quiet mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
52
to
+58
| async def open(self, mode: int = 0) -> bool: | ||
| """Send open command. 0 - performance mode, 1 - unfelt mode.""" | ||
| """Send open command. 0 - performance mode, 1 - quiet mode.""" | ||
| self._is_opening = True | ||
| self._is_closing = False | ||
| return await self._send_multiple_commands(OPEN_KEYS) | ||
| return await self._send_multiple_commands( | ||
| [OPEN_KEYS[0], f"{OPEN_KEYS[1]}{mode:02X}00"] | ||
| ) |
Comment on lines
+61
to
+62
| async def close(self, mode: int = 0) -> bool: | ||
| """Send close command. 0 - performance mode, 1 - quiet mode.""" |
Comment on lines
+65
to
+67
| return await self._send_multiple_commands( | ||
| [CLOSE_KEYS[0], f"{CLOSE_KEYS[1]}{mode:02X}64"] | ||
| ) |
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.
The open(), close(), and set_position() methods now accept a mode parameter (0 = performance, 1 = quiet) that controls motor speed. Previously open() and close() ignored the mode parameter and always sent hardcoded performance-mode commands.