hap-java / HAP-Java

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

Using EVE on iPhone stuck saying 'Adding Accessory' #20

Closed Shaun-Sheppard closed 7 years ago

Shaun-Sheppard commented 7 years ago

I don't know if this is an issue with library or something I'm potentially doing wrong, but I've setup an accessory to act as a Heating Thermostat, and when setup as a standalone accessory trying to add the device to EVE on my iPhone results in it being stuck saying 'Adding Accessory' after I've entered in the accessory PIN.

Initially I started the HAP server with the accessory in a bridge, and the bridge would always pair with the device fine, but sometimes the accessory wouldn't appear. Other times I would pair and the accessory would be visible.

There doesn't seem to be any errors in the console, and it seems to be showing that the pair was successful. This is what shows in the console;

10:18:45.458 [defaultEventExecutorGroup-4-1] INFO com.beowulfe.hap.impl.http.impl.AccessoryHandler - New homekit connection from /192.168.0.12:49317 10:18:45.461 [nioEventLoopGroup-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144 10:18:45.476 [defaultEventExecutorGroup-4-1] INFO com.beowulfe.hap.impl.pairing.PairingManager - Starting pair for Test Lightbulb 10:18:45.623 [defaultEventExecutorGroup-4-1] INFO com.beowulfe.hap.impl.http.HomekitClientConnection - 200 /pair-setup 10:18:45.627 [defaultEventExecutorGroup-4-1] DEBUG io.netty.util.internal.Cleaner0 - java.nio.ByteBuffer.cleaner(): available 10:18:50.632 [defaultEventExecutorGroup-4-1] DEBUG com.beowulfe.hap.impl.pairing.PairingManager - Entering second stage of pair for Test Lightbulb 10:18:50.737 [defaultEventExecutorGroup-4-1] INFO com.beowulfe.hap.impl.http.HomekitClientConnection - 200 /pair-setup 10:18:51.140 [defaultEventExecutorGroup-4-1] DEBUG com.beowulfe.hap.impl.pairing.PairingManager - Entering third stage of pair for Test Lightbulb Added pairing for 6a:b3:7d:f4:97:665AC69736-FDCD-4808-824E-A64DDFECD543 10:18:51.253 [defaultEventExecutorGroup-4-1] INFO com.beowulfe.hap.impl.jmdns.JmdnsHomekitAdvertiser - Re-creating service due to change in discoverability to false 10:18:53.261 [defaultEventExecutorGroup-4-1] INFO com.beowulfe.hap.impl.jmdns.JmdnsHomekitAdvertiser - Registering _hap._tcp.local. on port 9124 10:18:55.889 [defaultEventExecutorGroup-4-1] INFO com.beowulfe.hap.impl.http.HomekitClientConnection - 200 /pair-setup 10:18:56.111 [defaultEventExecutorGroup-4-1] INFO com.beowulfe.hap.impl.http.impl.AccessoryHandler - Terminated homekit connection from /192.168.0.12:49317 10:18:56.123 [nioEventLoopGroup-2-1] INFO io.netty.handler.logging.LoggingHandler - [id: 0x30dc7ed8, /0:0:0:0:0:0:0:0:9124] RECEIVED: [id: 0x0148198a, /192.168.0.12:49318 => /192.168.0.14:9124] 10:18:56.124 [defaultEventExecutorGroup-4-2] INFO com.beowulfe.hap.impl.http.impl.AccessoryHandler - New homekit connection from /192.168.0.12:49318 10:18:56.127 [defaultEventExecutorGroup-4-2] DEBUG com.beowulfe.hap.impl.pairing.PairVerificationManager - Starting pair verification for Test Lightbulb 10:18:56.135 [defaultEventExecutorGroup-4-2] INFO com.beowulfe.hap.impl.http.HomekitClientConnection - 200 /pair-verify 10:18:56.189 [defaultEventExecutorGroup-4-2] DEBUG com.beowulfe.hap.impl.pairing.PairVerificationManager - Completed pair verification for Test Lightbulb 10:18:56.190 [defaultEventExecutorGroup-4-2] INFO com.beowulfe.hap.impl.http.HomekitClientConnection - 200 /pair-verify 10:18:56.194 [defaultEventExecutorGroup-4-2] DEBUG io.netty.util.internal.JavassistTypeParameterMatcherGenerator - Generated: io.netty.util.internal.__matchers__.io.netty.buffer.ByteBufMatcher 10:18:56.230 [defaultEventExecutorGroup-4-2] INFO com.beowulfe.hap.impl.http.HomekitClientConnection - 200 /accessories

I had created by own Auth file and accessory, but I've reverted back to the standard Auth class and Mock Switch classes that came with the library and I still seem to be having the same issues.

I'm starting the server using;

HomekitServer homekit = new HomekitServer(PORT); HomekitStandaloneAccessoryServer accessoryServer = homekit.createStandaloneAccessory(new MockAuthInfo2(), new MockSwitch()); accessoryServer.start();

My Java project is a MVN project in IntelliJ on a Mac.

Shaun-Sheppard commented 7 years ago

Sorry, my fault. I was persisting the data to a JSON file, and the reason the accessory wasn't showing was because it had users registered in the JSON file.