ios 13.1.2 homekit accessory registration broken?

After installing ios 13 I have found that I can no longer register accessories to homekit. I'm using the Homekit Accessor Protocol Specification R1 Non-Commercial Version, and note that there is now a R2. Is there something in R2 that breaks integration with the previous version in ios 13?


Homekit is very difficult to debug as there does not appear to be any useful log or error information reported 😟. Homekit connects, appears to pair successfully with my accessory by completing the sequence, then drops the connection and reports that "Accessory couldn't be added".


Is there something I could do to resolve this new issue?

Accepted Reply

The HAP java folks seem to have sorted the problem. Between iOS12 and iOS13, the homekit developers appear to have changed the pairing behavior. Originally HAP java would update the bonjour registration to mark the bridge as no longer discoverable just before it send back its response to the final pairing message. Now in iOS13 homekit drops the connection when it sees that update; by defering the change to registration until later the pairing completes.

Replies

Anything from the apple team? I've tried with the HAP java implementation and it has the same problem.

I would track it down myself but I can find nothing on the phone related to what HomeKit is doing - it accepts then disconnects without any indication of the reason.

I do have a problem open in the apple system for this but there has been no response.

Weird that a long conversation would disappear...


I've installed and tested with iOS13.2, seems it's still broken. Still no response to the ticket that I've opened.


Is there anyone that knows how to retrieve a runtime log from HomeKit running on an iPhone? I've tried crawling through a syslog after enabling the homekit profile - while it appears to contain lists of the connected devices there's nothing that shows why it would drop a connection after completing the pairing sequence (esp when it's exactly the same sequence it has accepted in the past).

The Console application will show real time logs - examples via macOS 10.15.1 while exercising the Home app on iOS 13.2 with a connected iPhone:


-=-

default18:47:17.749450-0800homed[HTTPRequest (C9F18280-4EE0-455A-9775-D5196597F655)] Started
default18:47:17.749614-0800homed[HTTPResponse (72302551-5818-4D03-88E5-0CB597F5A2A3)] Invalidated after 0.010696s

-=-

error18:47:15.698740-0800homed[HTTPRequest (BEAA1537-A2B1-42B4-9A3F-88FD2663639A)] Thread left active (1): <NSThread: 0x1057279a0>{number = 452, name = main}

-=-

error18:47:17.134706-0800homed[MessageHandler: kAccessoryCharacteristicsChangedNotificationKey (0E937967-02D0-41BF-842C-141DF21073EE)] Thread left active (1): <NSThread: 0x107e50d90>{number = 455, name = (null)}


Some progress (in case it helps anyone else) - quamotion publishes a tool set for windows that includes a syslog monitor: http://docs.quamotion.mobi/docs/imobiledevice/tools/idevicesyslog/


From the syslog I get log entries showing pairing progressing, and a message on my own log that pairing succeeds. My code re-registers the accessory in bonjour (state change to not discoverable which I believe is required) which is seen in the log and works fine as best I can tell.


A few seconds later HomeKit drops the connection and I see this in the log:


Nov 6 09:48:54 ...-iPhone homed(CoreUtils)[145] <Error>: ### Error: CID 0x431A0003, Peer xBridge._hap._tcp.local.%9, -6723/0xFFFFE5BD kCanceledErr

Nov 6 09:48:54 ...-iPhone homed(CoreHAP)[145] <Error>: -[HAPAccessoryServerIP _handlePairSetupCompletionWithData:]_block_invoke ### Unable to send Pair Setup request, received response object: (null), MIME type: Unknown, error: Error Domain=HMErrorDomain Code=54 "Failed with OSStatus code -6723 (kCanceledErr)"


I've found a few references to this error and homekit but they're quite old. It sure looks like a purposeful cancel by homekit but I can't tell why.

The HAP java folks seem to have sorted the problem. Between iOS12 and iOS13, the homekit developers appear to have changed the pairing behavior. Originally HAP java would update the bonjour registration to mark the bridge as no longer discoverable just before it send back its response to the final pairing message. Now in iOS13 homekit drops the connection when it sees that update; by defering the change to registration until later the pairing completes.