Skip to content

fix(homekit): keep the IIDs of paired Home apps on HAP-python 5.2 - #242

Merged
lollox80 merged 1 commit into
mainfrom
fix/homekit-stable-iids
Dec 2, 2026
Merged

lollox80 merged 1 commit into
mainfrom
fix/homekit-stable-iids

Conversation

@lollox80

@lollox80 lollox80 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

HAP-python 5.2 (the version #238 moves to, and the one Home Assistant 2026.12 ships) adds an Active characteristic to every CameraRTPStreamManagement service. The accessory has three stream services, and pyhap creates them before ours. So with 5.2 every IID from the doorbell on moves:

  • Doorbell 32 → 35
  • Speaker 36 → 39
  • gate lock 39 → 42

The Home app keys rooms, names and automations on the IIDs, which is why the ring button option already keeps them stable (test_homekit_ring_button.py). On 5.2, IID 39, the gate until now, becomes the speaker.

The accessory now passes its own IIDManager to pyhap. It numbers everything as pyhap 5.0 did, and gives the Active characteristic of each stream service an IID of its own from 101 up, after all of ours. Nothing depends on the version number. With 5.0 nothing changes: that characteristic does not exist there.

Follow-up to #241.

Tests

  • The full IID table of the accessory with 5.0, written into the test, must come out of any pyhap, with the ring button off or on. Without the fix it fails with 5.2.0: the second stream service is 19 instead of 18, and so on.
  • The characteristics 5.2 added get unique IIDs, after all of ours, the same with the button on or off.
  • Checked by hand with 5.2: to_HAP() lists 43 distinct IIDs, and pyhap finds Active at IID 101.

Tested on Windows 11, Python 3.13, with both versions:

HAP-python 5.0.0: CHECK VERDE, 2506 passed, 32 skipped, coverage 97.2%
HAP-python 5.2.0: CHECK VERDE, 2506 passed, 32 skipped, coverage 97.22%

The CI pins HAP-python 5.0.0 until #238, and there the first test passes without the fix too: the proof is the 5.2.0 run above. The second test checks that 5.2 really adds three characteristics, so it cannot pass empty.

Home apps that already reconnected to 1.0.30 on HAP-python 5.2 saw the shifted IIDs. With this change they move back to the 5.0 ones, which those Home apps had until then.

Not tested: a Home app that was paired with 5.0 reading the accessory after an update to 5.2. Test at the intercom: not needed (no SIP, media, door or registration code is touched).

Changelog: Bug fixes - With HAP-python 5.2 (Home Assistant 2026.12) the HomeKit doorbell keeps the identifiers it already has in the Home app, so rooms, names and automations of the gate stay as they are.

Before you update: if your doorbell was already paired in the Home app and you ran an earlier version on Home Assistant 2026.12, open the Home app once after updating and check the gate's room, name and automations.

HAP-python 5.2 adds an Active characteristic to every camera stream
management service. Our three stream services come first, so every IID from
the doorbell on moved by three, and IID 39, the gate until now, became the
speaker. The Home app keys rooms, names and automations on those IIDs.

The accessory now passes its own IIDManager to pyhap: the numbering of 5.0,
with each of those Active characteristics given an IID of its own after
ours.
@lollox80
lollox80 added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit d0b1829 Dec 2, 2026
7 checks passed
@lollox80
lollox80 deleted the fix/homekit-stable-iids branch December 2, 2026 01:07
@lollox80 lollox80 mentioned this pull request Dec 2, 2026
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.

1 participant