Need to reset HomeKit pairing at every launch

Can one of you attach a longer log file? Looking at the snippet above, it does seem unlikely that iOS is trying to send a 36k message.

For me the following sequence worked to keep my pairing:

  1. Clear the existing pairing if one already exists.

  2. Restart openHab, this will log Could not find existing MAC...

  3. Do not pair yet but instead restart again. After the second restart the message does not appear again.

  4. Then pair. After a third restart the pairing still functions.

2 Likes

Thanks this thread has been helpful in resolving many of common issues pairing with OH2 with HK plugin.

I have one question though

After installing mapdb and following @richard1 steps, I no longer experience the need to repair with the HK addon ay every OH reboot. However I’m seeing following issue in my openhab.log. Any idea what could be wrong?

==> /var/log/openhab2/openhab.log <==
2016-11-09 22:31:56.809 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'ut': cannot invoke method public abstract org.eclipse.smarthome.core.types.State org.eclipse.smarthome.core.persistence.HistoricItem.getState() on null

Hi there
seems to be a quite old threat, but i experience the same issue of the “repair need” only since i installed openhab “final” 2.0. i did not had the issue with beta 4 (i guess that was the previous version before final).
@beowulfe Is it still a known bug in the final version?
EDIT: I thought i had installed the latest version but i had RC1 installed. I was on the unstable apt library. Made a clean install of the latest version on the stable package and everything works fine.

I am still having trouble keeping HomeKit working with openhab2. Is the mapdb persist hack still needed to make this work?

The mapdb hack was actually a coincidence, and actually didn’t do anything. The problem stems from a race condition in HomeKit. The steps to get it to work consistently are as follows:

  1. Log into karaf console and run smarthome:homekit clearPairings
  2. Restart openHab
  3. Check logs for [WARN ] [nhab.io.homekit.internal.HomekitImpl] - Could not find existing MAC in org.eclipse.smarthome.storage.json.JsonStorage. Generating new MAC. This will require re-pairing of iOS devices.
  4. Restart openHab again.
  5. Make sure you do not see the “Could not find existing MAC” message in the logs. If you do, start over.
  6. Repair your iOS device.
  7. Restart openHab to ensure it stuck.
3 Likes

Still having the same problem and the WARN Message is always there:

017-05-05 12:43:50.976 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'default.sitemap' has errors, therefore ignoring it: [7,1]: missing EOF at '{'

Welcome, You should start a new thread for questions not related to what is being discussed in this thread. You have a syntax error in your sitemap file, if you are editing it in the Eclipse Smart Home designer app it should give you a more detailed description of the error.

do i need a sitemap if i only would like to use the homekit and not the UI?

oh and i just realized i copyed the wrong WARN

[WARN ] [homekit.internal.HomekitAuthInfoImpl] - Could not find existing MAC in org.eclipse.smarthome.storage.json.JsonStorage. Generating new MAC. This will require re-pairing of iOS devices.

I think its now working, finally the warning was gone after several time trying. :slight_smile:

Andy, in web address https://github.com/beowulfe/openhab2/tree/homekit/addons/io/org.openhab.io.homekit you are mentioning window coverings, for me namely the rollershutters. However i couldn’t find that information in openhab2 distro snapshots. Are these already included in the distro binding, or the binding in your git page is different? Thanks

I have tried your method, but I do not seem to succeed.
And now iOS 11.2.5 (beta 7) seems to break it completely.

Hi there,
Any news on this? This tread is quite old bus still same problems in 2020. after reboot OH2 need to pair the device again!
Regards
Jochen

Hi Jochen,

this should not be the case anymore…
which version of homekit binding you have? do you see any exception in the log file? how you reboot OH2?

regards
Eugen

Hi Eugen,
homekit is really weird - I couldn’t see any device because my iPad had one home and my iPhone created a second home. Took me hours to find out what happened - also Siri didn’t work any more.
I think I’m good for now but its also good to know for everyone that this re-pairing problem should not exist anymore.
regards,
Jochen

1 Like

Hi Eugen,
after adding things to homekit in the config file which didn’t show up in homekit and after reboot (sudo /bin/systemctl restart openhab2.service) I received:

java.lang.Exception: Unknown user: 6CF1021E-19A2-493A-A6B9-24B207F64174 at io.github.hapjava.server.impl.pairing.PairVerificationManager.stage2(PairVerificationManager.java:113) ~[bundleFile:?] at io.github.hapjava.server.impl.pairing.PairVerificationManager.handle(PairVerificationManager.java:51) ~[bundleFile:?] at io.github.hapjava.server.impl.connections.HttpSession.handlePairVerify(HttpSession.java:127) [bundleFile:?] at io.github.hapjava.server.impl.connections.HttpSession.handleRequest(HttpSession.java:56) [bundleFile:?] at io.github.hapjava.server.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:56) [bundleFile:?] at io.github.hapjava.server.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:49) [bundleFile:?] at io.github.hapjava.server.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:52) [bundleFile:?] at io.github.hapjava.server.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:17) [bundleFile:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [bundleFile:4.1.42.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [bundleFile:4.1.42.Final] at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:56) [bundleFile:4.1.42.Final] at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:365) [bundleFile:4.1.42.Final] at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [bundleFile:4.1.42.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [bundleFile:4.1.42.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.42.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.42.Final]

Any ideas?

Latest openHABian 2.5.7-1
RaspberryPi 3b+
iPad Air iOS 12.4.8
iPhone iOs 13.4

argh. that one again.
this is known issue. it happens very seldom and is not producible.
we have no explanation yet.
but maybe you can help us to finally find the root cause.

background:
homekit binding stores IDs of paired devices in $OPENHAB_USERDATA/jsondb/homekit.json in the record called user. sometimes the user, i.e. paired device, disappears from homekit.json.

from the code it can happen only in following cases:

  1. command “clearPairings” was executed in karaf console
  2. device has trigged unpairing, e.g. you have removed home from home app. in which other cases device would trigger this, is unclear

i assume you have not done none from the 2 things above.
the last option - file homekit.json got corrupted, e.g. openhab was stopped during the writing of this file or users were only cached and never written to the file. this option is supported by the fact that it is usually happens only on restart. but it is strange that only users are effected and never other setting from homekit.json

it would be great help if you could answer following questions:

  1. have pairing survived restart before?
  2. what you get if you execute the command in ssh/command line

sudo grep user /var/lib/openhab2/jsondb/backup/*

  1. is it reproducable - if you pair and restart, do you get this issue again?
  2. was debug logging enabled?

The only mistake I did (I can remember) I had a wrong thing configured
ex:

Switch | SwitchSchalter | “Küche Spots” | {channel=“zwave:device:node33:switch_dimmer1”}
Dimmer | SwitchSchalter | “Küche Spots” | {homekit=“Lighting,Lighting.Brightness”,channel=“zwave:device:node33:switch_dimmer1”}

and I saved the config - error was shown in fontail log of course

Yes I think so - maybe I also did clearing OH cache?!

Nothing to see here

Will find that out in some days/weeks - for now I cleared pairings and added it again

No - I enabled it just in case. I keep working on my config for sure because I need to add support for venetian blinds and RGBW stips

For now: thanks for your help

regards,
Jochen

edit:
got kicked after reboot ( sudo /bin/systemctl restart openhab2.service )
maybe there is a difference to a full reboot (sudo reboot)
the debug log is too big for here (2,60 MB) – https://pastebin.pl/view/6522bc9e

Jochen, thank you for the input.

strange that you have nothing in the /backup/* directory. it means either the device id (from pairing) was never saved to the file or backup files were removed.

can you please check, once your openHAB is up and running and homekit is paired and working, whether you have “user” entry in the /var/lib/openhab2/jsondb/homekit.json, i.e.

cat /var/lib/openhab2/jsondb/homekit.json | grep user

btw, you can store homekit.json somewhere and restore it if you get the issue with unknown user again.

from the log file i can only see the the user is not there anymore but not why it was removed or never stored. it would interesting to see the log before restart/shutdown. what im looking for is the statement
“Remove user …”
in the log file.

best regards
Eugen