after rebooting OH3 @ RPi3, HomeKit basically stops working with my OH HomeKit bridge. Only solution out I found so far is to delete the openHAB bridge in HomeKit and re-add it.
But that’s pretty annoying, as I have to run again and again thru HomeKit initial setup, mapping the items to the rooms, actually around 40 devices …
Is that normal behavior? Or is there a way to prevent that behavior?
A reboot of that openHABian Raspberry is honestly nothing special will happen here and there for various reasons e.g. updates …
it is not normal behaviour. i do regular updates of my raspberry and reboot every second months or so. after reboot everything is back.
i have not done anything with mapdb… to my understanding, mapdb is used to store the state of the device but not the configuration. homekit configuration is stored in a file (homekit.json)
@yfre Thanks for replying, but what can then be the topic here?
homekit is as far as I can see directly available after reboot, other services does find it immediately and point to. Also delete and re-add openhab Bridge to HomeKit does work immediately …
Search for homekit.json, gave me 2 files on the system, but both of them don’t contain any mapping, just 5 entities, privateKey, user, salt, accessory_count, mac and revision …
I de-installed openHAB homekit yesterday, installed mapdb, and installed homekit again in OH. homekit.json has the timestamp according to that now.
For my home WiFi I have disabled private MAC address on my iPad and also iPhone. My iPad is defined as HomeKit Bridge/CentralCommand and I setup HomeKit stuff on my iPad, as it is more comfortable than on iPhone.
But my iPad is also running always iOS Beta versions, actually iOS15. That comes with a “Privat-Relay” addon for iCloud … hmm, I wonder if that could have influence here.
From my first basic understanding it shouldn’t, but well …
Ok, to make it short nothing did help so far, restarting OH3 makes all devices in HomeKit immediately unavailable.
mapdb didn’t do the trick, but I leave it installed, as it looks like a slim helpful addon, after reading documentation. It does store last status’/values, being available after next restart.
New iOS “Privat-Relay” forth and back did not change a thing at all, tested 4 times w/ and w/o.
In PaperUI is a setting for homekit regarding mDNS. Shall that be enabled or not?
can you check homekit.json? do you have “user” there? anything in the log files?
mDNS is the service that publish the ip address of the homekit bridge so that home app can find it. openHAB has built-in mDNS used for other binding. this switch defines whether homekit should use mDNS from openHAB or start a new mDNS service just homekit.
in general, usage mDNS from openHAB is a good idea as it save memory, etc. but there were reports that it is not always working for homekit. therefore the switch.
@yfre I deleted homekit.json several times for testing purposes, to check what’s happening with it.
A “user” attribute gets reliable created as soon as I add openhab to HomeKit at my iPad and also reliable deleted if I remove openhab bridge from HomeKit, when all devices are shown as unavailable resp. “not answering” … I checked that life watching “homekit.json”.
And that wonders me the most, I don’t see any messages in log after reboot RPi or just openhab regarding homekit. Whereas to be honest I haven’t seen any message related to HomeKit.
So, ok, need to find out, how to enable “using openhab mDNS for homekit” in “homekit.cfg”.
So, enabled tracing according to documentation, restarted OH and:
openhab> log:tail io.github.hapjava
11:17:34.716 [WARN ] [a.server.impl.connections.HttpSession] - Exception encountered while verifying pairing
java.lang.Exception: Unknown user: 7CD5A814-42C8-4766-B69D-7AB5A4AB6C1B
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:99) [bundleFile:4.1.63.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [bundleFile:4.1.63.Final]
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61) [bundleFile:4.1.63.Final]
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:370) [bundleFile:4.1.63.Final]
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [bundleFile:4.1.63.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [bundleFile:4.1.63.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [bundleFile:4.1.63.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [bundleFile:4.1.63.Final]
at java.lang.Thread.run(Thread.java:829) [?:?]
Then on removing openHAB bridge from HomeKit, no pairing exception …
ok. either the user (= device) was removed from homekit.json for some reasons or the device has changed his MAC address (maybe due private wifi settings)
“user” is device, e.g. iphone/ipad. it stores the MAC address which it has received from the device.
if it says "Unknown user: " that means that the mac address received from device was not found in the homekit.json
following activities remove “user” from homekit.json
device was unpair from openhab
clearPairings was executed from openhab karaf console
if none of these activities was done, then it is a bug in the binding or openhab
So, albeit my openhabian installation was just a few weeks old, I did a new installation from scratch yesterday, just to sort out I screwed anything within that. I took the chance to find out how fast I can recover in case a SD card is going to die, as I try to maintain my setup in plain files. It did work out good, recovery time is 1-1,5h, most time is going into waiting for openhabian getting ready after initial starts and restarts …
After all I have all my devices up and running and also HomeKit, saying in log to provide 42 devices for homekit.
@yfre Now added my openhab bridge again to HomeKit on iPad, scanning QR code. Checking directly what happens to “homekit.json”, I can see an user entry added. So, I copied that “homekit.json” for backup purpose.
Then the usual run thru HomeKit, sorting the devices to my HomeKit home. All good and I had the impression HomeKit reacts faster on my iPhone now.
This morning I checked again “homekit.json” and found out, there’s no user entry anymore! But HomeKit is usable perfectly on my iPad (HomeKit controller) and iPhone.
So, your idea an user is missing in homekit.json after reboot of OH might be the point. But that is obviously eradicated by openHAB itself … from unknown reason and time. In my case within the last 12-16h.
thank you for the investigation.
it is still unclear why the user get removed.
there are only these 2 cases in source code of homekit binding for “remove user”:
unpairing triggered by device
clearPairings (= unpairing triggered from karaf console)
but this is not your case.
there were some reports about user gets deleted when homekit configuration saved from UI but i could not reproduce it.