Fix RTW decoder off-by-one in command mapping (#664)#665
Open
mabt wants to merge 1 commit into
Open
Conversation
The RTW protocol decoder used `encKey - 133` to remap the command, but the encoder uses encKey values starting at 133 (My), so the correct offset is 132: - My (encKey=133) → cmd 1 ✓ (previously: 0=Unknown0, unreachable since '> 133') - Up (encKey=134) → cmd 2 ✓ (previously: 1=My) - Down (encKey=136) → cmd 4 ✓ (previously: 3=MyUp) - ... Fixes: linked remote presses now correctly update shade position on RTW motors (Mantion etc.). Tested with ESP32-WROOM-32 + CC1101 V2.0 + 10x Mantion Italian motors. Before: rolling code incremented but position stuck. After: position updates correctly when wall remote is pressed. Refs: rstrouse#664
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.
Fixes #664
Summary
The RTW protocol decoder remaps the command from the encKey byte. The current code uses
encKey - 133with conditionencKey > 133, but the encoder values start at 133 (My), so:> 133Fix
Change condition to
>= 133and offset to-132(one-line fix in 2 chars).After fix:
Testing
Tested with ESP32-WROOM-32 + CC1101 V2.0 + 10 Mantion Italian motors (RTW 80-bit). Before the fix, pressing the wall remote incremented
linkedRemote.lastRollingCodebutshade.position/shade.targetstayed unchanged. After the fix, pressing DOWN on the wall remote correctly setstarget=100,direction=1, and the shade tracks position to 100 within ~20s.Confirmed end-to-end: MQTT discovery to Home Assistant also receives the position update correctly, so the cover entity in HA syncs when wall remotes are used.