Homekit Setup

Homebridge in OH1 never give up… maybe in OH2 too. seems to be compatible… However … if you installed node.js by NPM try to uninstall and re-install by apt-get.

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install libavahi-compat-libdnssd-dev

For me it worked… now i can see Openhab2 accessory and i can link to it…
Try also in karaf console to clean all pairings you did…

Same issu here … My item :
String Eli location “eli” [ “String” ]
Switch EXEC {exec=">[ON:Say ON] >[OFF:Say OFF]"} [ “Lighting” ]
Switch testSwitch “My Switch” [“Lighting”]

all i see in homekit app is one openhab item and nothing else

I guess you just see your testSwitch item.
The homkit tag has to be definded before any binding config, so for your EXEC switch, it should look like

Switch EXEC [ "Lighting" ] {exec=">[ON:Say ON] >[OFF:Say OFF]"}

no I don’t have any items … Like this :

ok, so I misunderstood “all i see in homekit app is one openhab item and nothing else”

Just had a look, there is no “String” tag in the homekit docu, please remove it and try again.

did the trick thanks !

:+1:

I’m trying to pair my iPhone with the openHAB2 Homekit service and not having any luck. After I enter the PIN in the Home app, the pairing screen spins and never completes. I’ve included my item definition and relevant log excerpts. One thing I noticed is that the accessory is being displayed in the Home app as “openHAB (3)” although it’s being advertised as “openHAB”. I don’t know if that’s a problem or not. I see “openHAB (3)” in the HTTP request from iOS, but the 200 HTTP response seems to indicate successful stage one of the pairing process.

Hopefully someone can give me some hints here.


Item

Switch TestLight "TestLight" [ "Lighting" ]

openhab.log excerpts

2016-12-18 15:25:12.944 [INFO ] [com.beowulfe.hap.HomekitRoot  :72   ] - Added accessory openHAB
2016-12-18 15:25:13.094 [INFO ] [.i.h.i.NettyHomekitHttpService:62   ] - Bound homekit listener to /0:0:0:0:0:0:0:0:9123
2016-12-18 15:25:13.103 [INFO ] [i.jmdns.JmdnsHomekitAdvertiser:42   ] - Advertising accessory openHAB
2016-12-18 15:25:13.103 [INFO ] [i.jmdns.JmdnsHomekitAdvertiser:80   ] - Registering _hap._tcp.local. on port 9123
...
2016-12-18 15:25:33.838 [DEBUG] [.o.i.h.i.HomekitChangeListener:98   ] - Adding homekit device TestLight
2016-12-18 15:25:33.841 [INFO ] [com.beowulfe.hap.HomekitRoot  :72   ] - Added accessory TestLight
2016-12-18 15:25:33.843 [INFO ] [.i.h.i.NettyHomekitHttpService:81   ] - Resetting connections
2016-12-18 15:25:33.846 [DEBUG] [i.h.i.HomekitAccessoryRegistry:107  ] - Added accessory 805973497
2016-12-18 15:25:33.847 [DEBUG] [.o.i.h.i.HomekitChangeListener:101  ] - Added homekit device TestLight
...
2016-12-18 15:26:27.727 [TRACE] [.i.h.i.NettyHomekitHttpService:43   ] - READ UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 132, cap: 1024) [/10.0.0.16:51098]:
00000000 50 4F 53 54 20 2F 70 61 69 72 2D 73 65 74 75 70 POST /pair-setup
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 5C 30 33 32 28 33 29 2E  openHAB\032(3).
00000030 5F 68 61 70 2E 5F 74 63 70 2E 6C 6F 63 61 6C 0D _hap._tcp.local.
00000040 0A 43 6F 6E 74 65 6E 74 2D 4C 65 6E 67 74 68 3A .Content-Length:
00000050 20 36 0D 0A 43 6F 6E 74 65 6E 74 2D 54 79 70 65  6..Content-Type
00000060 3A 20 61 70 70 6C 69 63 61 74 69 6F 6E 2F 70 61 : application/pa
00000070 69 72 69 6E 67 2B 74 6C 76 38 0D 0A 0D 0A 00 01 iring+tlv8......
00000080 00 06 01 01                                     ....


2016-12-18 15:26:27.727 [INFO ] [h.i.http.impl.AccessoryHandler:33   ] - New homekit connection from /10.0.0.16:51098
2016-12-18 15:26:27.745 [INFO ] [ap.impl.pairing.PairingManager:34   ] - Starting pair for openHAB
2016-12-18 15:26:27.856 [INFO ] [i.http.HomekitClientConnection:57   ] - 200 /pair-setup
2016-12-18 15:26:27.861 [TRACE] [.i.h.i.NettyHomekitHttpService:43   ] - WRITE UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 512, cap: 512) [/10.0.0.16:51098]:
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 34 30 38 0D 0A 43 6F -Length: 408..Co
00000050 6E 6E 65 63 74 69 6F 6E 3A 20 6B 65 65 70 2D 61 nnection: keep-a
00000060 6C 69 76 65 0D 0A 0D 0A 06 01 02 02 0F 79 5E 42 live.........y^B
[Remaining bytes elided]


2016-12-18 15:26:27.883 [INFO ] [h.i.http.impl.AccessoryHandler:39   ] - Terminated homekit connection from /10.0.0.16:51098

I’m not an OpenHAB power-user (so I don’t unterstard TRACE level logs for example :wink: ) however I suspect this may be bug-related.

I have OH2 since few weeks (migrated from 1.x but only a few accessories connected for now) and HomeKit worked almost perfectly (had some issues with RGB LED Strip and Siri control but it might be my fault so never mind). Yesterday I’ve updated my setup (offline OH2 on RPi 3) by using “sudo apt-get update && sudo apt-get dist-upgrade”.

Since then Homekit stopped working. Firstly, my iOS devices started to show “non responding” message. Rebooting etc. made no effect. So I removed all my configuration of Home.app to unpair and pair again. I cleared parings using karaf console and now it shows OpenHAB while discovering devices but I can’t connect to it.

That said, I don’t remember doing anything else than just updating OH to SNAPSHOT of 18th December, so I think it may be just a bug. Hopefully it will be fixed.

PS I remember that when I paired my devices to OH2 at first, it also showed some number in the brackets after “OpenHAB”, so I think it is not related with the problem.

EDIT: Here is the last exception logged.

java.lang.NullPointerException
	at com.beowulfe.hap.characteristics.FloatCharacteristic.getValue(FloatCharacteristic.java:72)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.characteristics.BaseCharacteristic.makeBuilder(BaseCharacteristic.java:71)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.characteristics.FloatCharacteristic.makeBuilder(FloatCharacteristic.java:48)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.characteristics.BaseCharacteristic.toJson(BaseCharacteristic.java:61)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.impl.json.AccessoryController.toJson(AccessoryController.java:73)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.impl.json.AccessoryController.listing(AccessoryController.java:39)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.impl.connections.HttpSession.handleAuthenticatedRequest(HttpSession.java:70)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:51)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:46)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:47)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:15)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)[203:org.openhab.io.homekit:2.0.0.201612180944]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]

Thanks for the response. I haven’t seen that specific exception, but I also wonder if it’s related to recent openHAB2 changes or a change in the latest iOS firmware version.

I have just fixed my setup. It turned out to be related with my items (Astro binding stopped working after update as well) and after I had reorganized my items and things (this post was a hint: Testing HomeKit add-on on OpenHAB 2 ), Homekit started working. In the meantime I have updated OH2 to the most recent SNAPSHOT as well.

That being said, unfortunately I still have no idea how to solve your issue for sure but maybe our issues had something in common.

I’m glad it’s working for you. My items configuration is extremely simple since I’m just evaluating OH2 before migrating from OH1, I’ll try it again this weekend. If it still doesn’t work I’ll move on to other tasks, I was hoping @beowulfe might have some feedback.

@steve1 - there were no log lines after that pairing response, before the termination log line? (It’s okay that you trimmed the response, just want to make sure there were no other lines prefixed a date).

If so, that’s an odd place for it to fail. It would be unrelated to your item setup. Did you change the default pin?

@beowulfe. Thanks for the reply. I just tried it again and the pairing succeeded. I’m not sure what’s different. I did uninstall and reinstall the OH2 HomeKit service, but no version upgrades, etc. In any case, it seems to be working well now. Thanks again.

Hi all,

I have used homekit and OH quite successfully, also with Siri commands.

But when I get back home from being away from home, the connection between OH2 and homekit is lost. Happens almost every day. If I go into Paper UI and open the configuration of Homekit and just click save, that usually makes the connection ok again. Anyone else have had this experience?

And second, I have added more homekit tags in my items file ([“Lighting”]) but they do not appear in iOS app. What more is needed to add additional items in iOS app would you say?

1 Like

Hello,
My setup can include any items that i added from default.items file, but i can’t figure out items created by oh2 bindings, AKA inbox items. How do i do that?

i have the same issue. A workaround is to define the inbox detected item again in the .items file. That works for me but is a hack while investigating how to add the require (“Lighting”) tags etc via the GUI.

For me it works, if I use the HABmin UI. During the creation of an item from a thing (section channels), I can add the “Lighting” or “Switchable” Tag.

Re-Adding items OH1 way made the items controllable from homekit. But this is a shortcoming that has to be sorted out. A simple field on the paper UI should do the trick.

Does anyone have a working config for the release version of OpenHAB 2.0 ? My phone sees the openHAB accessory but nothing happens when trying to add it after entering the PIN

I don’t see any log entries from the homekit addon when the phone tries to connect, but while loading openHAB it does output about 30 repeated lines like these:
2017-01-27 20:32:25.986 [INFO ] [com.beowulfe.hap.HomekitRoot ] - Added accessory null
2017-01-27 20:32:26.006 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections

I thought it would just ignore items that didn’t have the correct tags assigned, it almost seems like something gets stuck trying to parse my item configs? Should I see any output from HomeKit about the items that have the Switchable tag assigned while starting up?