zha-device-handlers icon indicating copy to clipboard operation
zha-device-handlers copied to clipboard

Added a guide on writing V2 quirks

Open CalamityDeadshot opened this issue 3 months ago • 6 comments

Proposed change

Adding a zero-to-hero guide on writing V2 quirks, as I was asked to in this discussion.

CalamityDeadshot avatar Sep 18 '25 17:09 CalamityDeadshot

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 92.13%. Comparing base (2e2bbd9) to head (45b772b).

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Sep 18 '25 17:09 codecov[bot]

Thanks for this! Wondering if the PR supersede this previous not-yet-merged PR with "Initial quirks v2 documentation thoughts"?

  • https://github.com/zigpy/zha-device-handlers/pull/3019

Also see the related discussions here which is a request for a complete guide on how to write v2 quirks for ZHA:

  • https://github.com/zigpy/zha-device-handlers/discussions/2467

PS: FYI, btw, I submitted a PR for a guide on how-to test custom quirks in zha as a compliment to this howto guide:

  • https://github.com/zigpy/zha-device-handlers/pull/4355

Hedda avatar Sep 22 '25 09:09 Hedda

Wondering if the PR supersede this previous not-yet-merged PR with "Initial quirks v2 documentation thoughts"?

I don't think so, cuz the PR you linked goes a lot more in depth regarding the actual API - signatures, meaning of arguments and so on. This should definitely be available for people who don't want to or cannot read the actual code to understand what a function does. This PR is about how to write a quirk, whereas the one you linked focuses on how to write a quirk.

CalamityDeadshot avatar Sep 23 '25 10:09 CalamityDeadshot

@puddly @TheJulianJES Guys, I was wondering what your pull request approval process is. Is this gonna be merged?

CalamityDeadshot avatar Oct 18 '25 17:10 CalamityDeadshot

I'll check and merge this asap.

TheJulianJES avatar Oct 18 '25 20:10 TheJulianJES

I'll check and merge this asap.

@TheJulianJES would it perhaps be best if this PR could maybe just be merged 'as-is' ASAP and any issues with it be fixed later?

Hedda avatar Dec 11 '25 12:12 Hedda