Skip to content

Conversation

@jasonacox
Copy link
Owner

This pull request improves the handling and messaging for devices running Tuya protocol versions 3.4 and 3.5 in the tinytuya/scanner.py file. The changes clarify version detection logic, enhance user feedback with more accurate hints about possible device versions, and refine the protocol detection sequence to better distinguish between v3.4 and v3.5 devices.

Improvements to device version detection and messaging:

  • Updated comments and debug messages to indicate that devices may be running v3.4 or v3.5, not just v3.4, and clarified that version confirmation only occurs upon receiving a valid response.
  • Enhanced error and status messages throughout the scanning process to include hints when a device is likely v3.4 or v3.5, improving user feedback when polling fails or unexpected disconnects occur. [1] [2] [3]

Refinement of protocol detection logic:

  • Modified the data reading logic to prioritize checking for the v3.5 protocol prefix before falling back to the v3.4 prefix, ensuring more reliable detection of v3.5 devices during scanning. [1] [2]

Closes #671

Copilot AI review requested due to automatic review settings January 11, 2026 06:32
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 pull request enhances the scanner's ability to detect and identify Tuya devices running protocol versions 3.4 and 3.5, particularly when devices are unresponsive. The changes improve user feedback by clarifying that devices could be either v3.4 or v3.5 until a response is received, and refine the protocol detection sequence to prioritize v3.5 identification.

Changes:

  • Enhanced error messages and debug output to indicate that unresponsive devices are "likely v3.4 or v3.5" rather than assuming v3.4
  • Deferred version confirmation until actual device response is received, rather than marking v3.4 as confirmed immediately
  • Reordered protocol prefix detection to check for v3.5 before v3.4, improving v3.5 device detection reliability

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

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.

Fix: Scanner classifies device as v.3.4 when unable to confirm

2 participants