Skip to content

Fix RFRemoteControlDevice rf_send_button silently sending malformed payloads#684

Merged
jasonacox merged 1 commit intojasonacox:masterfrom
kongo09:fix_rf
Feb 22, 2026
Merged

Fix RFRemoteControlDevice rf_send_button silently sending malformed payloads#684
jasonacox merged 1 commit intojasonacox:masterfrom
kongo09:fix_rf

Conversation

@kongo09
Copy link
Contributor

@kongo09 kongo09 commented Feb 22, 2026

Three bugs that each independently caused rfstudy_send commands to be ignored by the device:

  • rf_decode_button: fix missing () on base64.b64decode call; always returned None
  • send_command: build correct rfstudy_send payload (feq as int, add mode/rate, inject ver into each key dict); study/exit commands are unaffected
  • rf_send_button: do not forward study_feq into feq; feq=0 tells the device to use the frequency embedded in the code, passing the actual value selects a different chip configuration path

Adds regression tests for all three fixes.

…ayloads

Three bugs that each independently caused rfstudy_send commands to be ignored
by the device:

- rf_decode_button: fix missing () on base64.b64decode call; always returned None
- send_command: build correct rfstudy_send payload (feq as int, add mode/rate,
  inject ver into each key dict); study/exit commands are unaffected
- rf_send_button: do not forward study_feq into feq; feq=0 tells the device to
  use the frequency embedded in the code, passing the actual value selects a
  different chip configuration path

Adds regression tests for all three fixes.
Copy link
Contributor

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

This PR fixes three critical bugs in the RFRemoteControlDevice module that were causing rfstudy_send commands to be silently ignored by the device.

Changes:

  • Fixed rf_decode_button method missing parentheses on base64.b64decode call, which was causing it to always return None
  • Fixed send_command to build correct payload structure for rfstudy_send mode (use feq as int instead of study_feq as string, add mode/rate fields, inject ver into each key dict)
  • Fixed rf_send_button to not forward study_feq into feq; feq=0 tells the device to use the frequency embedded in the code itself

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tinytuya/Contrib/RFRemoteControlDevice.py Fixed three bugs: missing function call parentheses in rf_decode_button, incorrect payload structure in send_command for rfstudy_send mode, and incorrect frequency forwarding in rf_send_button
tests.py Added comprehensive regression tests for all three bug fixes, including test_rf_decode_button_returns_dict and test_rf_send_button_payload_structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jasonacox jasonacox merged commit 9650179 into jasonacox:master Feb 22, 2026
21 checks passed
@jasonacox
Copy link
Owner

Thanks @kongo09 ! Good fix. 🙏

@kongo09 kongo09 deleted the fix_rf branch February 23, 2026 08:58
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.

3 participants