Bouke / HAP

Swift implementation of the Homekit Accessory Protocol
https://boukehaarsma.nl/HAP/
MIT License
366 stars 50 forks source link

Verify implementation against official spec #21

Closed Bouke closed 5 years ago

Bouke commented 7 years ago

See the spec which has become available: https://developer.apple.com/homekit/specification/.

tgu commented 7 years ago

HAP Spec 2.6.1

Instance IDs are numbers with a range of [1, 18446744073709551615]. These numbers are used to uniquely identify HAP accessory objects within an HAP accessory server, or uniquely identify services, and characteristics within an HAP accessory object. The instance ID for each object must be unique for the lifetime of the server/ client pairing.

When adding more than eight accessories (independent of type) to a device the Home app will protest on the eight accessory and claim that it is an unsupported accessory. Changing the aid numbering

accessory.aid = offset == 0 ? 1 : offset+100

will silent the protest. There seems to be more into this than just using unique aid numbering.

Bouke commented 6 years ago

Thanks, I've committed a fix for this in 634d5a29b8aa4e2748edc8fc627be3d5053546eb.

tgu commented 6 years ago

There seems to be more into to this see the fix 8e83fe071873535dbbfef3cb0d0651e7a01d2a99

The HAP specs are not clear (too me).

Bouke commented 6 years ago

I've tried replicating the issue of your previous comment, but was unable to. On my iPhone (6s / iOS 11.0.3) I'm able to pair with the demo HAP server included with this package. Any idea why you would need the offset, and how this ties into the specs?

tgu commented 6 years ago

With the demo HAP server and iPhone (6s/iOS 11.0.3) the results for me are

8e83fe071873535dbbfef3cb0d0651e7a01d2a99 - OK c6b9a14c7f384e4976bedb003d6dd6b0c283867a - silently refuse to pairing, the Bridge does not show up at all 9e2df10626eb7f22f3c3150c97061faf8e152f28 - paring is possible but the Toilet window is marked as not supported (Stöds inte, in Swedish)

img_4764

Bouke commented 6 years ago

Is this still a problem for you?

tgu commented 6 years ago

Now it works, thanks!

Bouke commented 5 years ago

Most gaps with the specs have been resolved. If any mismatch is found, we can open separate issues.