hap-java / HAP-Java

Java implementation of the HomeKit Accessory Protocol
MIT License
153 stars 82 forks source link

Accessories appear as offline after restart #11

Closed gdombiak closed 8 years ago

gdombiak commented 8 years ago

Hi,

I started playing with this library and it is really impressive how well it works. I created my own HomekitAuthInfo that is persisting the mac, salt privateKey and also the userKeyMap. My problem is that after I restart the server, the iOS app shows all accessories as offline. I looked at socket connections to my server and after the restart, I do not see any new socket connection to port 9123.

What am I missing? Every time I have to reset HomeKit configuration and pair again. I tried debugging the code and I do not see any attempt from the iPhone to establish a new connection. I verified that all settings are correctly stored and retrieved. I see the process listening on port 9123 but nothing connected. :(

Any help is greatly appreciated. Thanks, Gaston

andylintner commented 8 years ago

Are you implementing HomekitAuthInfo.hasUser? Starting with iOS8, the advertisement HomeKit makes includes a flag indicating whether the accessory is paired. If it advertises as unpaired (hasUser() returns false), iOS won't reconnect to it.

gdombiak commented 8 years ago

Andy,

YOU ARE THE BEST! Thanks so much for your quick reply. I implemented that method and it now works after the restart.

Amazing work you did on this library. :)

Thanks a lot. I'm now unblocked! Gaston

andylintner commented 8 years ago

Cool, glad it worked!