HomeKit unable to connect with accessories after the pairing steps

I am creating an accessory bridge in order to connect non MFi accessories to the HomeKit app. I am following the HomeKit Accessory Protocol Specification but I am stuck at the last step of the pairing process (over IP).

All the pairing steps seem to work correctly, from the pair-setup M1 step to the pair-verify M4 step. But after sending the last answer to the iPhone (pair-verify M4 step), the HomeKit app continues to try to add the accessory for a while and then stops with the message "Unable to connect with the accessory".


I configured my MDNS following the HAP spec with the parameters: c#=1, s#=1, ff=0, ci=2, sf=0, pv=1.1.


I compared the HTTP requests and responses between the iPhone and the accessory I obtained on Wireshark with the exchanges obtained using an MFi accessory (a Philips Hue Bridge), and the only difference is in the body of the pair-setup M4 step. According to the HAP spec, the M4 body must contain two elements: the kTLVType_State and the kTLVType_Proof. But the body of the Hue Bridge M4 step contains one more element, which is a kTLVType_EncryptedData.


Has anybody had this kind of problem ? Does anybody know why there is a difference between the body of the MFi M4 step and the non MFi M4 step ? Do I have to add a key to the M4 body ?


All the steps work correctly, I don't have any error message, I don't understand why the accessory can't be connected to HomeKit.


Thank you for your help.

Replies

To my knowledge, a proper MFi certified device returns additional encrypted data from the apple authentication coprocessor in step 4, but that's why you need to advertise ff=0 instead of ff=1. ff=0 means your device is not MFi certified, so the iOS device should not expect the additional validation information from the authentication coprocessor. So if it's failing on step 4 it's probably an SRP problem.