hap-java/HAP-Java

No response from bridge

watta90 opened this issue · 3 comments

Problem
Bridge, together with all the devices, show "No response" in Home app. Home app doesn't try to do any new connection to the bridge even if you force close the app or reboot your iOS device completly. The bridge is publishing the bonjour service so it's possible to connect a new iOS device to this bridge. The only solution to make the iOS device connect again is to remove the bridge and re-pair it.

Reproduce
I can reproduce this almost every time by using 15 accessories (with 1-2 characteristics each) and then rebooting the bridge. The devices are loaded dynamically so after the bridge has started it might reset the homekit connections while new devices gets registered. Sometimes it's also possible to reproduce by adding new devices in the system and then reset the connection to make homekit reconnect.

Conclusion
Sounds like homekit doesn't like when it reconnects and there are changes in accessories. I don't know if it's the bridge that fails to send complete messages which makes Home app ignore this bridge.
I have the logs from my iOS device from the three phase

  1. Adding the bridge
  2. Rebooting the bridge
  3. Reconnecting to the bridge

In the reconnecting phase you can see these logs

default	14:01:24.514148 +0100	homed	### Accessory is missing an Accessory Information Service
default	14:01:24.514727 +0100	homed	### Accessory failed _updateForAccessoryInformationService
default	14:01:24.515085 +0100	homed	### Accessory failed _updateAndValidateServices
default	14:01:24.515868 +0100	homed	### Unable to parse serialized accessory
default	14:01:24.517951 +0100	homed	[Home] Failed HAP service discovery on accessory server <HAPAccessoryServerIP>    Device ID: f6:84:xxxx    Model: TestBridge    Protocol Version: (null)    Source Version: (null)    Config Number: 1    Category: 1    Status Flags: 0x1 with error: Error Domain=HMErrorDomain Code=66 "(null)"

Anyone have any idea why this is happening?

(Tag @joenicorata)
homekit_reconnect.log
bridge_reboot.log
homekit_add.log

I can actually close this issue. Problem solved.

The problem was because my devices got registered dynamically and all the characteristics weren't loaded when homekit connected. Since some devices where missing characteristics homekit decided to "blacklist" the bridge and it was impossoble to reconnect after this state.

How are you handling it in your logic? I am currently still experiencing this, but it seems to fit all of the symptoms you describe. All other devices maintain functionality while one device will show not responding on all accessories

My accessories are dynamically loaded as well