Skip to content

Add quietdrift (quiet mode) support for roller shades#456

Open
sjafferali wants to merge 1 commit intosblibs:masterfrom
sjafferali:master
Open

Add quietdrift (quiet mode) support for roller shades#456
sjafferali wants to merge 1 commit intosblibs:masterfrom
sjafferali:master

Conversation

@sjafferali
Copy link

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.

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
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
switchbot/devices/roller_shade.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 provided mode.
  • 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(), and set_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"]
)
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.

2 participants