Skip to content

Feat/tuyaopen auth#34

Merged
shiliu-yang merged 17 commits intomasterfrom
feat/tuyaopen-auth
Apr 17, 2026
Merged

Feat/tuyaopen auth#34
shiliu-yang merged 17 commits intomasterfrom
feat/tuyaopen-auth

Conversation

@shiliu-yang
Copy link
Copy Markdown
Contributor

No description provided.

Implement TuyaOpen device authorization via serial commands:
- auth_protocol: serial command send/receive (read_mac, auth-read, auth write)
- excel_parser: read/write authorization code Excel files with file locking
- auth_handler: core authorization flow with retry, read-back verify, and log
- auth_ui: GUI mixin with background workers for non-blocking serial I/O
- Add Auth tab to ui_main.ui with config, status, progress, and log panels
- Restore missing SerDebug pushButtonSDDump3/Dump4 lost during .ui edit
- Add openpyxl dependency to requirements.txt

Made-with: Cursor
- Fix Windows compatibility: replace fcntl with conditional import (msvcrt)
- Fix GUI freeze: wrap AuthWorker.run() in try/except to always emit signal
- Fix file handle leak: wrap authorize_single() body in try/finally
- Fix slow response: add idle_timeout to _read_response for early return
- Fix thread cleanup: add auth workers to _wait_threads()
- Fix progress bar: use busy mode (indeterminate) during authorization
- Fix SerDebug button text: restore original KWS/VAD channel labels
- Fix mask_authkey: mask short authkeys, fix AuthLogger null safety
- Remove duplicate command logs and unused import

Made-with: Cursor
Strip ANSI escapes, discard device log lines and shell prompts from
auth responses; detect Excel columns by header aliases instead of
hardcoded indices and create .bak backup before writing.

Made-with: Cursor
Avoid overwriting "already authorized" label with generic "success"
when the worker finishes on a previously authorized device.

Made-with: Cursor
Create a .bak copy of the authorization Excel before any write
operations to prevent data loss from unexpected errors.

Made-with: Cursor
…ation

- Add retry mechanism for MAC reading (up to MAX_RETRIES)
- Add on_confirm callback for user-driven conflict resolution
- Implement find_by_mac() in excel_parser for cross-validation
- Detect auth mismatch when device UUID/AUTHKEY differs from Excel record
- Detect unknown batch when MAC not found in Excel
- Show confirmation dialogs (Yes/No/Copy) for user to decide override or skip
- Convert confirmation messages to English, remove AUTHKEY masking in dialogs
- Add confirm_signal and thread-safe event handling in AuthWorker
- Update status display for skipped/auth_mismatch states
- Enhance QMessageBox with Copy button for dialog text

Made-with: Cursor
Place About as a corner widget on the menubar and set AA_DontUseNativeMenuBar on Linux so the control is not hidden by global menu export.

Made-with: Cursor
@shiliu-yang shiliu-yang reopened this Apr 17, 2026
@shiliu-yang shiliu-yang merged commit 42adb7c into master Apr 17, 2026
1 check passed
@shiliu-yang shiliu-yang deleted the feat/tuyaopen-auth branch April 17, 2026 08:11
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.

1 participant