Skip to content

fix(roller-shade): send Roller Shade commands instead of Curtain commands - #367

Merged
donavanbecker merged 1 commit into
latestfrom
fix/roller-shade-commands
Nov 20, 2026
Merged

donavanbecker merged 1 commit into
latestfrom
fix/roller-shade-commands

Conversation

@donavanbecker

Copy link
Copy Markdown
Contributor

What changed

WoRollerShade was an empty subclass of WoCurtain, so setPosition() sent the Curtain packet 57 0F 45 01 05 FF <pos>, which the Roller Shade rejects with 0x0D. It now uses the Roller Shade command set from pySwitchbot's SwitchbotRollerShade (ROLLERSHADE_COMMAND = "4701", control source 00):

  • setPosition / open / close: 57 0F 47 01 01 00 01 <position> (the packet the reporter verified on a real shade). If that is rejected, 57 0F 47 01 05 00 <mode> <position> is tried over BLE.
  • pause: 57 0F 47 01 00 00 01.
  • OpenAPI fallback: setPosition with the bare position, as in the Roller Shade API page (previously the Curtain-style 0,ff,<pos>).
  • Positions are as the shade reports them (0 open, 100 closed); status parsing is unchanged.

Fixes #365

Deliberate deviations

  • pySwitchbot sends both position commands and succeeds if either works. Here the second is sent only if the first fails, so the shade isn't commanded twice and the OpenAPI fallback still applies to the first.
  • The optional second argument of open/close/setPosition is now the pySwitchbot mode (0 performance, 1 quiet) instead of the Curtain speed (1-255), and other values throw a RangeError. The Curtain speed never worked on a Roller Shade, and homebridge-switchbot calls setPosition(position) only, so no migration is needed there.

Checks

npm run build, npm test (531 tests) and npm run lint pass locally. New tests in test/devices/roller-shade.test.ts pin the packets.


Generated by Claude Code

…ands

WoRollerShade inherited WoCurtain's commands, so setPosition sent the Curtain
packet 570f450105ff<pos>, which the Roller Shade rejects with 0x0D. Use the
Roller Shade command set from pySwitchbot's SwitchbotRollerShade
(ROLLERSHADE_COMMAND 4701, control source 00):

- setPosition/open/close: 570f470101 00 01 <position>; if that fails, the
  position-with-mode command 570f470105 00 <mode> <position> over BLE
  (mode 0 performance, 1 quiet)
- pause: 570f470100 00 01
- OpenAPI setPosition takes the bare position (0 open, 100 closed)

Status parsing is unchanged.

Fixes #365

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LzktUspaxcZ9Dh5WVEtf5W
@donavanbecker
donavanbecker merged commit 2232e62 into latest Nov 20, 2026
3 checks passed
@donavanbecker
donavanbecker deleted the fix/roller-shade-commands branch November 20, 2026 18:51
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.

WoRollerShade sends Curtain BLE command; Roller Shade rejects it (response 0x0D)

2 participants