Skip to content

Conversation

zimme
Copy link

@zimme zimme commented Sep 7, 2025

Proposed change

Introduces TY0201Device with direction fix logic to handle incorrect ZCL direction in Tuya TY0201 temperature and humidity sensors. Updates the quirk to use the new device class and removes the tuya_enchantment call.

Fixes zigpy/zigpy#1640 (comment).

Additional information

This is a quirk specific fix for _TZ3000_zl1kmjqx (and friends) but I saw in zigpy/zigpy#1640 that there seems to be more Tuya devices that have this wrong direction thing going on for different clusters.

Perhaps a solution to introduce a TuyaCustomDevice class with this direction flipping logic similar to Aqara/Xiaomi, that will be used as the base for the current base classes, should be done instead of quirk specific fixes?

Device diagnostics

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works
  • Device diagnostics data has been attached

Introduces TY0201Device with direction fix logic to handle incorrect
ZCL direction in Tuya TY0201 temperature and humidity sensors.
Updates the quirk to use the new device class and removes the
tuya_enchantment call.
Copy link

codecov bot commented Sep 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.13%. Comparing base (2e2bbd9) to head (fcf23ac).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #4319   +/-   ##
=======================================
  Coverage   92.13%   92.13%           
=======================================
  Files         358      358           
  Lines       11919    11931   +12     
=======================================
+ Hits        10981    10993   +12     
  Misses        938      938           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Introduces a test to verify that the TY0201 quirk correctly handles
devices sending ZCL commands with an incorrect direction.
The test ensures no direction-related warnings are logged and that the
custom TY0201Device class is used.
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.

Cluster ... has incorrect direction warning
1 participant