Testing HomeKit add-on on OpenHAB 2

I’m not getting far enough to even enter the PIN: In EVE, Pairing openHAB shows a progress bar, but when it finishes, it goes back to “pick an accessory”, rather than asking for the PIN.
Any suggestions? I’m trying to get the trace log, but not sure I’m doing it right, as nothing appears to be getting logged.

One thing I do see in the normal log is this:
2016-03-12 14:19:27.782 [WARN ] [nhab.io.homekit.internal.HomekitImpl] - Could not find existing MAC in org.eclipse.smarthome.storage.mapdb.MapDbStorage. Generating new MAC. This will require re-pairing of iOS devices.

I’m experiencing the same issue

I Had the same problem, but after reboot my Raspberry Pi, it worked perfectly.

I think we are quite anxious, me included…

I think the README could use a bit of extra guidance for a few things that I found/find to be confusing:

  1. How do you add openHAB to HK in the first place? Answer: you need an app for HGK discovery on your iPhone. I only have wave items and the ecobee app, which only discovers the thermostat, so this wasn’t very obvious. I found a free app for managing HK devices which worked.
  2. How do you link existing items (i.e. wave items) with HK items? (my guess is using groups?)
  3. What commands are available via Siri?
  4. If I add/modify items for the HK binding, do I need to remove/re-add the pairing in iOS?

If I go to the /accessories URL, I get the same 404 error that others were having…I tried the export command before starting OH to no avail.

A bit of a follow up to answer some of my own questions (for anyone who happens upon this).

  1. As noted: you need some for of HomeKit app.
  2. It looks like “tags” are it. I can’t find a way to use them other than creating items from within an item file…which I’m not using at that moment. @chris is there any chance of having the ability to either edit items via HM2 (and tags) soon? Or @Kai is there any way to edit/tag items via the karaf console?
  3. It looks like HK will pick up new items as you define them. Though I changed the name of one and it didn’t pull that update.

It think we’ll have to wait for a fix in ESH:

Well, at least the way I read it, the issues is only if you’re using REST or need HM2 to add the tags…which is why I’m also asking if there’s a way to manage the tags via console.

I’ll tried out a lot, HABmin, REST, .items-file. Would be happy if there is a way via console :smile:

There currently isn’t, but feel free to create a PR for it (or enter an issue at least at Issues · eclipse-archived/smarthome · GitHub.

Thanks for pointing me to the right point for an Issue :smile:

As casual user with knowing a little bit about programming its not the time for me to think about PRs - i’m still happy to not overstrain some maintainers with missing knowledge about relationships between OH1, OH2, ESH and so on :wink:

While I’d love to get more involved with actually helping the development of OH2, my skill set is in Ruby/PHP and my Java experience is pretty limited…so at least for now, I don’t have the time to really dig in and figure it all out (especially as it’s not like I can easily get it going with my usual text editor setup). Thus I’m limited to testing/reporting issues.

moving my system to a Mac (and to the latest version of everything) fixed this problem, paired right up and Siri is controlling thins!

I’m not sure when it happened, but in the last few days, HomeKit quit working completely – devices lost contact, restarting openHAB didn’t hep, tried resetting pairings, resetting HomeKit (i.e,. starting from scratch from HomeKit’s point of view), updating openHAB, nothing has worked, my HomeKit apps simply do not see the openHAB server.

Edit: it occurred to me that this happened about the same time I got openHAB running as a launchd service instead of from command line, so the problem may be related to the java environment variable. Will try fixing that tonight.

Edit2: yep, that was it, added the Java Opt variable to my launchd script and that fixed it.

Here is the tail end of my log, seems like it is almost there:

2016-04-21 18:38:32.757 [DEBUG] [impl.pairing.PairVerificationManager] - Completed pair verification for openHAB
2016-04-21 18:38:32.761 [INFO ] [ap.impl.http.HomekitClientConnection] - 200 /pair-verify
2016-04-21 18:38:32.761 [TRACE] [pl.http.impl.NettyHomekitHttpService] - WRITE UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 105, cap: 256) [/10.0.0.52:64425]:
00000000 48 54 54 50 2F 31 2E 31 20 32 30 30 20 4F 4B 0D HTTP/1.1 200 OK.
00000010 0A 43 6F 6E 74 65 6E 74 2D 74 79 70 65 3A 20 61 .Content-type: a
00000020 70 70 6C 69 63 61 74 69 6F 6E 2F 70 61 69 72 69 pplication/pairi
00000030 6E 67 2B 74 6C 76 38 0D 0A 43 6F 6E 74 65 6E 74 ng+tlv8..Content
00000040 2D 4C 65 6E 67 74 68 3A 20 33 0D 0A 43 6F 6E 6E -Length: 3..Conn
00000050 65 63 74 69 6F 6E 3A 20 6B 65 65 70 2D 61 6C 69 ection: keep-ali
00000060 76 65 0D 0A 0D 0A 06 01 04                      ve.......


2016-04-21 18:38:32.766 [TRACE] [pl.http.impl.NettyHomekitHttpService] - READ UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 78, cap: 512) [/10.0.0.52:64425]:
00000000 3C 00 2B 11 FB 92 8A B3 DB 92 0A 30 96 E5 18 9A <.+........0....
00000010 AB 59 CA A6 AC 19 03 BF C0 2E 7E E1 08 58 08 61 .Y........~..X.a
00000020 25 4B 19 6D B2 83 F3 36 22 40 42 F7 07 49 B9 98 %K.m...6"@B..I..
00000030 44 70 01 A7 16 3F DF 75 AF FE CE EE A7 E3 D1 34 Dp...?.u.......4
00000040 EF 4F 0E FF CE 01 A6 51 3D 1C 75 CF 83 32       .O.....Q=.u..2


2016-04-21 18:38:32.766 [TRACE] [ons.LengthPrefixedByteArrayProcessor] - Received message of length 78. Existing buffer is 0
2016-04-21 18:38:32.767 [TRACE] [ons.LengthPrefixedByteArrayProcessor] - Attempting to read message of length 78
2016-04-21 18:38:32.767 [TRACE] [ons.LengthPrefixedByteArrayProcessor] - Read complete message
2016-04-21 18:38:32.767 [TRACE] [ons.LengthPrefixedByteArrayProcessor] - Returning 1 results
2016-04-21 18:38:32.767 [TRACE] [lfe.hap.impl.http.impl.BinaryHandler] - Received data [/10.0.0.52:64425]:
00000000 47 45 54 20 2F 61 63 63 65 73 73 6F 72 69 65 73 GET /accessories
00000010 20 48 54 54 50 2F 31 2E 31 0D 0A 48 6F 73 74 3A  HTTP/1.1..Host:
00000020 20 6F 70 65 6E 48 41 42 2E 5F 68 61 70 2E 5F 74  openHAB._hap._t
00000030 63 70 2E 6C 6F 63 61 6C 0D 0A 0D 0A             cp.local....


2016-04-21 18:38:32.779 [ERROR] [lfe.hap.impl.connections.HttpSession] - Could not handle request
java.lang.ClassCastException: org.eclipse.smarthome.core.items.GroupItem cannot be cast to org.eclipse.smarthome.core.library.items.SwitchItem
	at org.openhab.io.homekit.internal.accessories.AbstractHomekitLightbulbImpl.getLightbulbPowerState(AbstractHomekitLightbulbImpl.java:37)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.services.LightbulbService.lambda$new$45(LightbulbService.java:18)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.characteristics.common.PowerStateCharacteristic.getValue(PowerStateCharacteristic.java:38)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.characteristics.BaseCharacteristic.makeBuilder(BaseCharacteristic.java:71)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.characteristics.BaseCharacteristic.toJson(BaseCharacteristic.java:61)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.json.AccessoryController.toJson(AccessoryController.java:73)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.json.AccessoryController.listing(AccessoryController.java:39)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.connections.HttpSession.handleAuthenticatedRequest(HttpSession.java:70)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:51)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:46)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:47)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:15)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)[166:org.openhab.io.homekit:2.0.0.201604210102]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_77]
2016-04-21 18:38:32.780 [INFO ] [ap.impl.http.HomekitClientConnection] - 500 /accessories
2016-04-21 18:38:32.781 [TRACE] [lfe.hap.impl.http.impl.BinaryHandler] - Sending data [/10.0.0.52:64425]:
00000000 48 54 54 50 2F 31 2E 31 20 35 30 30 20 49 6E 74 HTTP/1.1 500 Int
00000010 65 72 6E 61 6C 20 53 65 72 76 65 72 20 45 72 72 ernal Server Err
00000020 6F 72 0D 0A 43 6F 6E 74 65 6E 74 2D 4C 65 6E 67 or..Content-Leng
00000030 74 68 3A 20 32 38 0D 0A 43 6F 6E 6E 65 63 74 69 th: 28..Connecti
00000040 6F 6E 3A 20 6B 65 65 70 2D 61 6C 69 76 65 0D 0A on: keep-alive..
00000050 0D 0A 6A 61 76 61 2E 6C 61 6E 67 2E 43 6C 61 73 ..java.lang.Clas
00000060 73 43 61 73 74 45 78 63 65 70 74 69 6F 6E       sCastException


2016-04-21 18:38:32.781 [TRACE] [pl.http.impl.NettyHomekitHttpService] - WRITE UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 128, cap: 256) [/10.0.0.52:64425]:
00000000 6E 00 90 4F 68 52 0D 6E EC 3B AF D0 97 35 3E 6F n..OhR.n.;...5>o
00000010 26 32 9E D6 2C 8D 66 0C 7F CC B6 0C 4E 69 6C 88 &2..,.f.....Nil.
00000020 2C B1 CA B6 3E 0D 3C 40 41 0B 96 86 A9 F2 50 2A ,...>.<@A.....P*
00000030 6C 47 09 D4 54 2E 01 BE 2F 9E 72 40 E9 FA 81 C5 lG..T.../.r@....
00000040 CC 8D 23 BF EB C5 D0 84 13 EB 27 CA BA 22 9A 16 ..#.......'.."..
00000050 D7 51 E8 7F D4 45 89 DF 85 B5 73 96 4C D2 99 13 .Q...E....s.L...
00000060 72 B0 A2 CA 65 42 DD 68 83 E4 40 63 FF B6 29 A4 r...eB.h..@c..).
00000070 64 AE 36 79 A6 73 DC C8 B6 A5 BE BD 7B 46 45 AF d.6y.s......{FE.


2016-04-21 18:38:32.786 [TRACE] [ons.LengthPrefixedByteArrayProcessor] - Received message of length 0. Existing buffer is 0
2016-04-21 18:38:32.786 [TRACE] [ons.LengthPrefixedByteArrayProcessor] - Returning 0 results
2016-04-21 18:38:32.787 [INFO ] [.hap.impl.http.impl.AccessoryHandler] - Terminated homekit connection from /10.0.0.52:64425

Any thoughts??

so, if i need to create an item file for the work around, how is rhis done? similar to oh1?

My issue was user error. I had a lot of homekit items configured and must have had a mixup with the type I was specifying.

@Heiko_Fanieng Just s a head’s up, @chris has added the ability to edit tags in HABmin (thanks Chris!) Also, ESH has fixed the colon bug, and the HK binding actually changed the tags to not need the homekit prefix.

1 Like

i hsve chaged my tsgs to meet the new requirements, but using eve, it just gets stuck scanning for accessories.

ensbled addon under misc. tab, tagged items with proper tags, created a homekit.cfg with host ip sames as oh2 server ip. what might i be missing?

@Branden_Smale I had a similar issue and it took some fiddling to get going. I reset the pairing and also restarted my phone, OH, etc a number of times…and then it finally popped up to pair (it sat there for a while first though). Since then it’s worked great though.

i have reset pairing, will try phone. thx