[homekit] "No response" error on all openHAB items

Thanks Eugen.

I have checked my homekit.json:

It includes no user, but the following fields:
accessory_count, privateKey, salt, mac, and revision, but no user.

The MAC address is not known to me. It is not my iPhone I used for pairing or any other device in my network AFAIK. I did/do not use Private WiFi Address.

Any way I can restore the HomeKit integration in a state that is is working again?
I have 22 Zwave items for which I added meta data and I would avoid going thru the whole process especially if the problem can happen again.

Kind regards

Bodo

I have just

  1. removed HomeKit integration and re-added it,
  2. repaired openHab via my iPhone
  3. checked homekit.json for “user”: success
  4. made an backup of homekit.json
  5. re-added all items to Home.app again (that was easy and fast, since all metadata still available)
  6. added additional items to HomeKit
  7. Opened json.db for checking total numbers of accessories: now in total 37

IMPORTANT: While I was checking in step 7 the homekit.json for the number of “accessory_count”, guess what!? homekit.json does NOT contain the user any longer!

So, somewhere in between step 4 and 7 the homekit.json got touched and user entry removed.So it seems, that updates to the file (e.g. with accessory_count) corrupts the file…?

Interesting, even if homekit.json does not contain “user” Apple Home.app still sees openhab bridge working and all accessories responding. I guess this will last until I restart openHab.

What do you think?

EDIT: My saved homekit.json includes three users. The corrupted none. My saved file says revision 32, the corrupted one says 47.

EDIT2: I shut openHab down, replaced the corrupted homekit.json with the saved copy and started openhab again: success. Openhab bridge and all accessories working. So the copy of homekit.json saved me.

1 Like

thank you for the investigation. yes, homekit.json backup was a good idea.

what is strange - it is always removing the user and nothing else.
if the file would get corrupted completely or different parts would be removed, then i could think about caching or some interruption during file writing. but it is alway the user. and in the code i have not found any logic to remove the user from file, except of 2 cases mentioned above: clearPairing and unpairing from device…

strange.

Hhmm. Let’s think trough it.

I did only add HomeHit meta data to existing items. It seems to me that during this process the homekit.json receives updates, which corrupts the file by removing the user.

I am not a developer. But would it be possible to debug step by step through the process of adding Homekit meta data to items to see, if there is anything which triggers the corrupting update to the homekit.json?

@Nathaniel85 Pls check your homekit.json as I did (see thread upwards) and confirm if you are OK there. Maybe you have the same issue as I have.

I have posted my finding before here:

For me editing the Metadata has no effect on the Homekit.json file, I have made at-least 100 changes to the metadata of my items since I first discovered the work around I use. its when I click save in HomeKit Add-on settings part of OpenHab that I lose integrity of the.json file.

Personally I make a backup of the .json file and replace it if my Items get stop responding. So far i’ve only needed to do this the first time I figured it out, and have since avoided making changes to the settings for HomeKit and thus far have not had this issue for more then 70 days now.

I am interested to know if anyone else can reproduce my findings. I don’t think it matters but I am running my OH Server on MacOS 10.14.6.

I can confirm, that I just added HomeKit meta data to an additional item, accessory_count got incremented with the add. item, but user was NOT removed. Strange…

What happens if you go into the settings for the HomeKit add-on, change something like " * Use Fahrenheit Temperature" option, then save the changes and check the .json file. I suspect if you repeat that a few times, you will be able to produce a .json file that has lost data. I know I was messing with my Nest thermostat when I made the discovery. I know I was changing, Use Fahrenheit option often trying to get the temperatures to covert properly so Homekit displayed the correct Temperature in F. I was also changing the “Thermostat Target Heating/Cooling Mapping” and “Thermostat Current Heating/Cooling Mapping” frequently as well.

I suspect the damage is done when saving the settings to disk, but then only discovered at a later time when the .json file is reloaded. If I remember correctly Saving the settings did not Always produce the issue for me, but then again I did not systematically test each value individually. It’s possible only 1 of 2 of the of the settings might cause the damage, and I just happened to not change them some times witch would appear to me an intermittent issue.

I am not 100% certain but I also suspect that the file only gets rewritten to disk if one of the values has changed, so opening settings and changing nothing or deleting and reentering the same values then clicking save won’t cause the .json file to be rewritten, and only if something actually changes will the save take place.

I just changed setting “Start Delay” in HomeKit add-on multiple times and saved.
No change of homekit.json…

I believe we might have a coincidence between changes in HomeKit add-on, as experienced by @Prillin, or item updates, as experienced by me, with corruption of homekit.json.

Edit: Just added new Zwave devices and added HomeKit metadata to their items. No change of homekit.json. So, it seems it was really a coincidence before that I observed corruption of homekit.json after adding homekit meta data to items…

Hello Eugen,

I have the same problem again.
User is removed from the JSON file.
However I found an old backup file with 2 User entries.
I copied the first user section into the recent JSON db file and restart the bundle.
Now SF value is 0 instead of 1 and Homekit does work again. :slight_smile:
BTW - Does it make sense to have 2 users?

hi Stefan,

openhab creates user for each paired device (it stores the public key of the device used for encryption).

however, to my understanding not every device need to be paired as they get connected via icloud. but i dont have details on this.

i have 3 users in my homekit json but a more than 3 ios devices at home.

I cannot track down the issue any further.
For me it is definitely not caused by

  • adding Homekit meta data to an item
  • changing the settings of the Homekit addon

Have now multiple backups of homekit.json.

Let‘s see what happens…

Hi Eugen,

Homekit stopped working yesterday when I activate my new iPhone.
Could be by coincidence as I cannot find openhab in Discovery app (_hap._tcp) anymore in .
I checked the homekit.json file and the user still exit in the file.
Toggling the mDNS option in openhab doesn’t solve the issue - also clearing the bundle doesn’t help.

==> /log/openhab.log <==
2021-09-26 12:00:38.485 [WARN ] [.server.impl.connections.HttpSession] - Exception encountered while verifying pairing
java.lang.Exception: Unknown user:

I guess this error could be related

Hi Stefan,

do you see openhab in Discovery app after you have changed the mDNS option? actually you should it see. maybe something with network setting, e.g. wrong wifi.

once you see it, it either will work or you would need to re-pair.

So for me at least it is solved and it seems to be indeed a router/network issue.

While this is a radical step, I moved from an AmplifiHD Mesh to an OpenWRT Mesh (running TP-Link Archer C7 routers with 802.11s) and since then, homekit works flawlessly.

not that you all should move to OpenWRT, but it shows that the router / network hardware and software indeed can be the issue.

I have the same suspicion:

I’m using Unifi APs, switches and a USG Pro 4 gateway. Every time I restart or update the switch (or the gateway) the openHAB HomeKit connection is lost. I suspected a new IPv6 address is given to the client and somewhere this information is lost (the IPv4 address does not change, DHCP is set to “fixed address”).

This happened with openHABian on a RasPi 4 and in a docker container running on my Synology NAS. Restarting the docker and the RasPi solves the issue until the next reboot of the switch/gateway.

Same issue here. Every restart removes the user from homekit.json.

I am continuing to investigate and have followed much of the advice above.

1 Like

Would it be an option to setup HomeKit as you want and then change the file permissions? For example change the ownership of the file?

the issue is really a mystery for me.
can you try to enable trace log like this

log:set TRACE org.openhab.io.homekit.internal

every time the “removeUser” function called, it make a log message “Remove user <user_id>”

here is the part in the code doing this

there is no other place in the code that removes users from the homekit.json.

Hi all,

I have this sympton from time to time! So another miracle to the behavior:
I tell siri to switch on a light, and it fails. You check homekit, and after a while “no response”.
Then I do NOTHING…after some minutes (or an hour maybe), I do exactly the same, and it works. no changes in between or something…this behavior is NOT REPRODUCABLE for me. it appears, it works for some time, it disappears somehow. Maybe some kind of “wake up call” for homekit sometimes?

I have the feeling it belongs to iOS 15…

maybe a hint for the search of the problem. Up to now I live with it, but yes, it is annoying.

Best regards
Stefan

PS:

  • Use openHAB mDNS service is OFF