Repository navigation
fix(homekit): work with HAP-python 5.2 as well as 5.0 - #241
Merged
Merged
Conversation
HAP-python 5.2 makes AccessoryDriver.srp_verifier a read-only property over _srp_verifier. Replacing it with the counting verifier raised AttributeError, so pair-setup failed at M1. _Driver now has its own property, with a setter, over the same attribute: 5.0's assignments and 5.2's direct write both end up there. The tests now run pair-setup up to M4 with a real SRP client, and the ten wrong codes across the 60 s lockout that 5.2 adds.
This was referenced Dec 2, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
#238 moves HAP-python from 5.0.0 to 5.2.0, the version Home Assistant core is moving to (2026.12), and two tests fail. One of the two failures is a real bug: with 5.2 pair-setup stops at M1 with a 500, so the HomeKit doorbell cannot be paired.
5.0:
srp_verifieris a plain attribute thatsetup_srp_verifier()assigns.5.2: it is a read-only property over
_srp_verifier, so our assignment of the counting verifier raisesAttributeError._Drivernow has its ownsrp_verifierproperty, with a setter, over_srp_verifier. It serves both versions without checking the version number. The other failure was only in the tests: the_driver()helper skips__init__and lackedaccessory, which 5.2'sunpair()reads.pyhap 5.2's own lockout
From 5.2 pyhap refuses pair-setup for 60 s after five wrong codes. Our count of ten wrong codes in a row, which changes the setup code and notifies the user, is unchanged:
Tests
_Driverbuilt by the installed pyhap's__init__.test_pyhaps_verifier_is_the_counting_onefail with 5.2.0.Tested on Windows 11, Python 3.13, with both versions:
HAP-python 5.0.0: CHECK VERDE, 2504 passed, 32 skipped, coverage 97.22%
HAP-python 5.2.0: CHECK VERDE, 2504 passed, 32 skipped, coverage 97.21%
Not tested: pairing with a real iPhone, M5/M6, and a running Home Assistant 2026.12. Test at the intercom: not needed (no SIP, media, door or registration code is touched).
Changelog: Bug fixes - HomeKit pairing works with HAP-python 5.2 (Home Assistant 2026.12).