Skip to content

Conversation

@puddly
Copy link
Contributor

@puddly puddly commented Nov 17, 2025

Proposed change

This PR migrates almost all straightforward V1 quirks to V2. This was mostly done with an automated tool to hint LLM agents about the exact quirk signature -> replacement transformation. This covers about half, the other half are:

  • Most of Aqara/Xiaomi
  • All of Tuya
  • XBee

I don't expect this PR to be merged as-is (we could...). We can use bits and pieces of it and migrate individual manufacturers (or groups of manufacturers) at once.

Some nice APIs to have in the future:

  1. Regex or wildcard applies_to(), for King of Fans.
  2. I'd like to move away from modifying the underlying ZCL device. We can use an overlay to change metadata, if possible:
    • replaces_endpoint -> modify_device_type(endpoint_id=1, device_type=zha.DeviceType.DIMMABLE_LIGHT)?
    • .replaces(DoublingPowerConfig1CRCluster, endpoint_id=1) can likely be replaced with a hint to the underlying PowerConfiguration cluster entity. Entity creation hints might be be a good middle ground API between quirk IDs and directly creating entities from quirks.
    • All instances of .removes() should probably be replaced with .prevent_default_entity_creation()
  3. The only uses of filter thus far are .filter(lambda device: WWAH_CLUSTER_ID not in device.endpoints[1].in_clusters), in lieu of using firmware version filters.
  4. Data bus objects: needs more thought.
  5. _CONSTANT_ATTRIBUTES can also be replaced with a hint to the underlying ZCL cluster entity? We really only override color mode, mireds, and feature bitmaps.

Additional information

Device diagnostics

Too many and not enough.

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

@puddly puddly force-pushed the puddly/quirks-v2-migration-test2 branch from 3efa1e9 to 259e574 Compare November 17, 2025 23:19
@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 94.57701% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.57%. Comparing base (1e5953b) to head (259e574).
⚠️ Report is 7 commits behind head on dev.

Files with missing lines Patch % Lines
zhaquirks/elko/smart_super_thermostat.py 47.61% 22 Missing ⚠️
zhaquirks/aurora/aurora_dimmer.py 75.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4499      +/-   ##
==========================================
- Coverage   92.24%   91.57%   -0.67%     
==========================================
  Files         369      367       -2     
  Lines       12094    11086    -1008     
==========================================
- Hits        11156    10152    -1004     
+ Misses        938      934       -4     

☔ 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.


def __init__(self, *args, **kwargs):
"""Init."""
self.occupancy_bus = Bus()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunately still used by MotionCluster, so we can't just remove that.

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.

2 participants