Homekit not working properly

@SpeedMaxX tagging would be nice, but a stable version would be much nicer. I wonder if someone has HomeKit up and running in a stable manner.

define stable…
My setup is quiet stable - unless openhab is restarted (https://github.com/openhab/openhab2-addons/issues/1822) and ignoring Homekit not working properly
but I am using temp and humidity sensors and a couple of switches
waiting for new accessories

@Chri46 I have two issues right now with 2.1 HomeKit stops working after several hours and sometimes time based rules also stop working. That’s the reasons I consider 2.1 unstable.

openHAB 2.2.0 Build #1065 has same issue:

2017-10-21 01:47:15.255 [ERROR] [lfe.hap.impl.http.impl.BinaryHandler] - Exception in binary handler
java.io.IOException: Connection timed out
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [?:?]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [?:?]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) [?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [?:?]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:880) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at java.lang.Thread.run(Thread.java:748) [?:?]
2017-10-21 01:47:15.263 [ERROR] [.hap.impl.http.impl.AccessoryHandler] - Exception caught in web handler
java.io.IOException: Connection timed out
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [?:?]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [?:?]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) [?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [?:?]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:880) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [354:org.openhab.io.homekit:2.2.0.201710181101]
	at java.lang.Thread.run(Thread.java:748) [?:?]

On my install (on Rasp) Homekit seems to run quite good, as long as I don´t remove the IOS device from the OpenHab server connection. I´ve had Homekit running smooth for several days, but once I disconnect the IOS device from wifi (hence, disconnect from OpenHab) I get an exception (2017-11-05 19:40:18.173 [ERROR] [lfe.hap.impl.http.impl.BinaryHandler] - Exception in binary handler java.io.IOException: Connection reset by peer) and the same exception in web handler. The exception is of cause natural (I actually disconnected), but Homekit does not seem to handle the exception correctly (allow for reconnection at a later time) with the result that I have to reset the pairing key information and basically start over. Sounds familiar ?

@SpeedMaxX have a look at this Other homekit types through red-node in the interim as it doesn’t look like homekit will be supporting other types any time soon :frowning:

same with OH2.2 build:

And it is 100% related to iOS device leaving wifi/ losing network connectivity.

2017-12-20 13:09:26.400 [ERROR] [lfe.hap.impl.http.impl.BinaryHandler] - Exception in binary handler
java.io.IOException: Connection timed out
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [?:?]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [?:?]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) [?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [?:?]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:880) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [213:org.openhab.io.homekit:2.2.0]
	at java.lang.Thread.run(Thread.java:748) [?:?]
2017-12-20 13:09:26.409 [ERROR] [.hap.impl.http.impl.AccessoryHandler] - Exception caught in web handler
java.io.IOException: Connection timed out
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [?:?]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [?:?]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) [?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [?:?]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:880) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [213:org.openhab.io.homekit:2.2.0]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [213:org.openhab.io.homekit:2.2.0]
	at java.lang.Thread.run(Thread.java:748) [?:?]

I have been noticing this again as well now that I’m on 2.2.

Hi,

Just started getting these errors as well, do we know if its fixable/avoidable?

2018-01-04 11:25:51.755 [ERROR] [lfe.hap.impl.http.impl.BinaryHandler] - Exception in binary handler
java.io.IOException: Connection timed out
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [?:?]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [?:?]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) [?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [?:?]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:880) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [224:org.openhab.io.homekit:2.2.0]
	at java.lang.Thread.run(Thread.java:748) [?:?]
2018-01-04 11:25:51.762 [ERROR] [.hap.impl.http.impl.AccessoryHandler] - Exception caught in web handler
java.io.IOException: Connection timed out
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [?:?]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [?:?]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) [?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [?:?]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:880) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [224:org.openhab.io.homekit:2.2.0]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [224:org.openhab.io.homekit:2.2.0]
	at java.lang.Thread.run(Thread.java:748) [?:?]

OH2.2 as well

I have exactly the same problem.
@beowulfe Will there be a solution for this problem?

Same for me.

I’ll see if I can repro this - seems like it should be easy to.

2 Likes

Many thanks Andy. Let me know if you need more Information to track this.

I have this same issue. Please just let me know if I can supply any logs or anything else to help resolve this issue.

Thanks

As I reported earlier in this thread, these exceptions are harmless and they’re just the result of an iOS device timing out or leaving the wifi network or losing connection some other way. They just clutter the log.

The exceptions have been fixed in the HAP-Java repository since August 2016, but OH has not gotten an update… probably because of the indecision on semantic tagging?

Is anyone actually seeing any negative effects on functionality because of these exceptions? Everything works fine for me. The fix in holgerebert’s comment here to make the HomeKit JSON DB non-writable stopped any problems with reboots as well (so far):

nope. same here.
just a simple timeout error (could be changed to Warn level maybe?) being logged when the iPhone goes offline.
Functionality is not affected when iPhone is back online. Homekit works properly (on openHAB 2.3.0 Build #1178)

After this exception the HomeKit is not connected anymore to my OH 2.2.
In iOS Home App I get all devices listed as not reachable.
The only way I found to solve this problem is to clear the pairings and connect again.

I also had issues with Homekit connectivity. I could not connect to devices returning home especially when I tried to connect to them when I was away from home with the ‘Home’ app.
I got a Philips Hue set a while back (3 lamps and a bridge) and since the homekit has been rock solid. Not a single issue in over a month in connectivity. When I added the Hue set i was also able to add my girlfriends phone (different icloud account). Previously the invitations gave an error. When I added the Hue suddenly the queued invitations were all send out.

Maybe someone with a Hue set can confirm this.
Could not be happier with the OpenHab setup as my domotica does not support Siri natively.

Same problem here! Nothing working until i restart my raspberry …

These exceptions show up in my logs too. Everything seems to work just fine. But really don’t like all this log cluttering .

If i understand @anthonygillet this was fixed 1,5 years ago but it’s not yet in openHAB. Maybe @beowulfe could look into this?

The semantic tagging topic for openHAB is getting nasty slow (2 years!) and long, so maybe these fixes can be implemented before that discussion is solved, if it ever gets solved?! I’m happy to test or support in anyway i can. I just lack the knowledge to make a PR.