Getting HomeKit paired

service
ubuntu
homekit
Tags: #<Tag:0x00007f15d9c76690> #<Tag:0x00007f15d9c76550> #<Tag:0x00007f15d9c763e8>

(Womble) #1

I wanted to join the community with some information rather than a question for once.
I was having trouble getting the homekit module to pair with my phone. Here is what i did to get it working. Feel free to comment if any of these steps are redundant / wrong / could be better.

stop openHAB2 & launch karaf console using

sudo systemctl stop openhab2.service
sudo /usr/share/openhab2/start.sh

once in Karaf, view logging status and enable more logging

log:list 
log:set TRACE com.beowulfe.hap

log:set TRACE org.openhab.homekit

watch the logs

tail -f /var/log/openhab2/openhab.log

OpenHAB appear in my iOS Home app as an accessory, but pairing always timed out. Nothing showed up in the logs even. If i accessed the default port (9124) with a browser lots happened in the logs as you can imagine.

The fix.

All the above was really to consolidate when i found from many hours messing around into one place. the fix (i think!) was to change the port from 9124 to 51826. You can do this in the Paper UI via
Configuration> Services> (HomeKit)CONFIGURE. This is the port that the Hombridge project uses, i’ve not tired any other.

my setup for reference.
tvOS 10.1
iOS 10.2
Ubuntu 16.04
openHAB 2.0.0.b5
HomeKit Integration (misc-homekit - 2.0.0.b5)


ITEAD Sonoff switches and sockets - cheap ESP8266 Wifi+MQTT hardware
(Łukasz Dywicki) #2

Hey @womble,
While it is not said directly in homekit integration nor beowulfe library, there are additional ports involved in communication. Discovery of OpenHab is done via UDP (you can use any bonjour browser to verify that), and then Home application connects over configured port which also needs to be visible from your local network. Timing out of pairing could be related to HTTP connectivity issue.


(Womble) #3

Thanks for the additional insight @splatch

Given its working i won’t spend too much more time on it. Everything is on the same subnet with any ACLs or FWs, although there are 3 switches involved.


(Trent D) #4

I had the same issue with v2.0.0-1. It would just sit there spinning while “Joining” the device. What worked for me was to change the interface to the actual IPv4 address of the server (it only has one interface, but I’m guessing this stopped using the IPv6 port).

On a previous snapshot I did not have this problem, but working now so I’m happy! :slight_smile:


(Egor Lukyanov) #5

Nothing works for me :frowning:


(Maxwell) #6

I have the same problem but I can’t solve it.
Changed port but the new connection is terminated immediatelly.

2017-04-14 20:57:42.922 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2017-04-14 20:57:42.923 [INFO ] [ap.impl.jmdns.JmdnsHomekitAdvertiser] - Registering _hap._tcp.local. on port 51826
2017-04-14 20:57:42.923 [INFO ] [com.beowulfe.hap.HomekitRoot ] - Added accessory null
2017-04-14 20:57:42.927 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2017-04-14 20:57:42.928 [INFO ] [com.beowulfe.hap.HomekitRoot ] - Added accessory null
2017-04-14 20:57:42.931 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2017-04-14 20:57:42.932 [INFO ] [com.beowulfe.hap.HomekitRoot ] - Added accessory Wally
2017-04-14 20:57:42.936 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2017-04-14 20:57:42.937 [INFO ] [com.beowulfe.hap.HomekitRoot ] - Added accessory Kitchen Light
2017-04-14 20:57:42.941 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
2017-04-14 20:59:26.651 [TRACE] [pl.http.impl.NettyHomekitHttpService] - READ UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 125, cap: 1024) [/192.168.8.2:63467]:
2017-04-14 20:59:26.651 [INFO ] [.hap.impl.http.impl.AccessoryHandler] - New homekit connection from /192.168.8.2:63467
2017-04-14 20:59:26.665 [INFO ] [ulfe.hap.impl.pairing.PairingManager] - Starting pair for openHAB
2017-04-14 20:59:28.953 [INFO ] [ap.impl.http.HomekitClientConnection] - 200 /pair-setup
2017-04-14 20:59:28.957 [TRACE] [pl.http.impl.NettyHomekitHttpService] - WRITE UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 512, cap: 512) [/192.168.8.2:63467]:
2017-04-14 20:59:29.031 [INFO ] [.hap.impl.http.impl.AccessoryHandler] - Terminated homekit connection from /192.168.8.2:63467
2017-04-14 20:59:51.087 [INFO ] [.hap.impl.http.impl.AccessoryHandler] - New homekit connection from /192.168.8.2:63468
2017-04-14 20:59:51.088 [TRACE] [pl.http.impl.NettyHomekitHttpService] - READ UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 125, cap: 1024) [/192.168.8.2:63468]:


(Maxwell) #7

This Bound homekit listener to /0:0:0:0:0:0:0:0:51826 looks strange to me or is it ok?

[INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory openHAB
    2017-04-14 21:22:21.115 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory null
    2017-04-14 21:22:21.144 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Bound homekit listener to /0:0:0:0:0:0:0:0:51826
    2017-04-14 21:22:21.173 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
    2017-04-14 21:22:21.195 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory null
    2017-04-14 21:22:21.201 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
    2017-04-14 21:22:21.202 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory null
    2017-04-14 21:22:21.209 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
    2017-04-14 21:22:21.211 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory Wally
    2017-04-14 21:22:21.220 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
    2017-04-14 21:22:21.222 [INFO ] [com.beowulfe.hap.HomekitRoot        ] - Added accessory Kitchen Light
    2017-04-14 21:22:21.232 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
    2017-04-14 21:22:21.410 [INFO ] [ap.impl.jmdns.JmdnsHomekitAdvertiser] - Advertising accessory openHAB
    2017-04-14 21:22:21.412 [INFO ] [ap.impl.jmdns.JmdnsHomekitAdvertiser] - Registering _hap._tcp.local. on port 51826

(Robert K.) #8

Don’t know if it helps for this problem, but I was unable to pair homekit because I had some items defined homekit doesn’t like for some reason. Just try to remove the tag for homekit at some/all items and add them piece by piece watching, if homekit stops working.

Cheers,
Boby


(Timo Welsch) #9

Hi,

what do you mean with ip v4 of the device?
BR

TImo


(Trent D) #10

On the configuration screen for HomeKit (Paper UI > Configuration > Services > Homekit) there is a “Network Interface” field, in that I put the actual IP address of my OpenHab server (I think it was blank by default).


(Timo Welsch) #11

Ah Okay thats what i did already I get the follwoing issue

06:15:35.304 [INFO ] [.hap.impl.http.impl.AccessoryHandler] - New homekit connection from /192.168.0.10:58591
06:15:35.318 [TRACE] [pl.http.impl.NettyHomekitHttpService] - READ UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 125, cap: 1024) [/192.168.0.10:58591]:
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 2E 5F 68 61 70 2E 5F 74 openHAB._hap._t
00000030 63 70 2E 6C 6F 63 61 6C 0D 0A 43 6F 6E 74 65 6E cp.local…Conten
00000040 74 2D 4C 65 6E 67 74 68 3A 20 36 0D 0A 43 6F 6E t-Length: 6…Con
00000050 74 65 6E 74 2D 54 79 70 65 3A 20 61 70 70 6C 69 tent-Type: appli
00000060 63 61 74 69 6F 6E 2F 70 61 69 72 69 6E 67 2B 74 cation/pairing+t
00000070 6C 76 38 0D 0A 0D 0A 00 01 00 06 01 01 lv8…

06:15:35.332 [INFO ] [ulfe.hap.impl.pairing.PairingManager] - Starting pair for openHAB
06:17:02.387 [INFO ] [ap.impl.http.HomekitClientConnection] - 200 /pair-setup
06:17:02.400 [INFO ] [.hap.impl.http.impl.AccessoryHandler] - Terminated homekit connection from /192.168.0.10:58591
06:17:02.434 [TRACE] [pl.http.impl.NettyHomekitHttpService] - WRITE UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 513, cap: 1024) [/192.168.0.10:58591]:
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 39 0D 0A 43 6F -Length: 409…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 10 63 2C 31 live…c,1
00000070 22 8F AA 00 9F 02 29 FA 51 9B C6 13 E6 03 FF 36 “…).Q…6
00000080 9A 7F 05 08 24 39 BB C6 FA D3 56 A8 59 82 AD 29 …$9…V.Y…)
00000090 61 96 71 85 7B 6F 84 50 9A 83 0D F8 38 2E E8 D9 a.q.{o.P…8…
000000A0 6E EC 9D 95 00 0A 2C 61 64 12 F7 B1 69 0F DB 17 n…,ad…i…
000000B0 7F FC 5C DE 4D 65 67 67 FF D9 4E CF 5E DC 61 E8 …Megg…N.^.a.
000000C0 C6 AD A5 60 61 38 05 BF 93 8C F0 6E BF 95 C4 8E …a8.....n.... 000000D0 D6 FC 7E B8 0C 90 8D F8 6F 36 C7 EF B1 7E 02 96 ..~.....o6...~.. 000000E0 DC 2E 4D F5 14 E3 C7 A0 0E DA 70 9A FA 8C 3C B7 ..M.......p...<. 000000F0 98 FF B6 AD 42 C9 CC 4B 2A 14 E6 F6 07 24 30 E5 ....B..K*....$0. 00000100 35 AA 17 B2 C0 C3 FC 32 4E 7F 7B 83 3D FE 33 43 5......2N.{.=.3C 00000110 3F AC F1 3A 4A 67 84 1A 58 76 9C AD C6 CA AD 79 ?..:Jg..Xv.....y 00000120 28 7B 47 69 1A 7B B8 81 8B 6B 24 C5 A4 D9 6B DE ({Gi.{...k$...k. 00000130 2E 9F DB 5C 96 62 59 C3 30 62 E9 68 16 E9 01 0A ...\.bY.0b.h.... 00000140 E0 FF 60 E2 3E 82 B1 7D 0D 92 49 88 6E 7B AC 4B ...>…}…I.n{.K
00000150 08 27 C6 9D 30 FD 17 C3 70 25 DC 44 81 09 24 A3 .’…0…p%.D…$.
00000160 A3 FB 31 69 3C 20 A7 CA 10 03 E8 7E 9C FA A5 BC …1i< …~…
00000170 E4 ED 87 07 73 8A F4 EE BC 83 0E E3 F8 11 03 81 …s…
00000180 27 12 D1 C1 50 B2 CF E3 4B 1F 80 02 4A F1 F3 A7 '…P…K…J…
00000190 1C 42 70 09 7C 7B 68 86 E0 A5 59 CF D9 1A D3 4B .Bp.|{h…Y…K
000001A0 B5 45 5C 58 C1 AE 9E 69 81 C6 DF 7C EE 55 47 DF .E\X…i…|.UG.
000001B0 63 35 48 41 43 0E D4 DB 77 D5 1A E1 75 1A 1B F8 c5HAC…w…u…
000001C0 F6 22 1D E5 7C EC 0B 18 E7 4F CA EA CE 46 4E 94 .”…|…O…FN.
000001D0 A1 30 54 69 26 02 98 AC 6C 03 A5 B1 54 6C CC 23 .0Ti&…l…Tl.#
000001E0 F4 30 B4 DB 7B C7 70 BC AC 86 45 83 7A C1 BE 26 .0…{.p…E.z…&
000001F0 EE 58 1B 4D 77 D6 B2 E0 AC 79 F1 49 DF 50 7C 2D .X.Mw…y.I.P|-
00000200 9A .

08:18:08.814 [INFO ] [com.beowulfe.hap.HomekitRoot ] - Added accessory openHAB
08:18:08.867 [INFO ] [com.beowulfe.hap.HomekitRoot ] - Added accessory Licht_Schlafzimmer
08:18:08.890 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections
08:18:08.900 [INFO ] [com.beowulfe.hap.HomekitRoot ] - Added accessory Licht_Wohnzimmer
08:18:08.922 [INFO ] [pl.http.impl.NettyHomekitHttpService] - Resetting connections

ins IOS app I get could not connect …
Firewall from the Server is switched off


(Nathan Stratton) #12

Anyone know how to do this with manual config?


(Timo Welsch) #13

Is there nobody out there facing the same error?
I havw switched all firewalls …
Tried already also 3 different ios devices?


(ankur pansari) #14

I got homekit and openhab pairing working again by switching to ethernet from wifi.

It appears that Bonjour doesn’t rely on TCP/IP for certain packets and many wifi routers filter out these non-standard messages by default. I was unable to figure out the correct wifi settings to get it to work on my Asus-Merlin router but this current solution is working great.

Hope you will all try this if you’re stuck and report back if it worked.

Also, the port I used is 51826