Closed RafalLukawiecki closed 4 years ago
Further clarification: disabling Homekit authentication by using smarthome:homekit allowUnauthenticated true
has the effect that the error is no longer logged, but the Home app is no longer able to communicate with any of the accessories and shows "No Response" for each of them.
please check the user id stored in homekit jsondb
cat /var/lib/openhab2/jsondb/homekit.json
you must have an entry
user_
e.g. in my case i have
{ "user_c2:d:4:ce:ac:f7261219C9-2D81-4D63-C616-CBE877D34CB0": { "class": "java.lang.String", "value": "psGthUfHHqk3mwVgyhVem8MZLw2enWo91JGt3QUr21U\u003d" },
if the user is different, then change it but dont touch the "value"
Thank you, @yfre, for your help. My homekit.json does not have a user
entry at all. The entire homekit.json contains:
{
"privateKey": {
"class": "java.lang.String",
"value": "Ld***\u003d"
},
"salt": {
"class": "java.lang.String",
"value": "-15365***031"
},
"mac": {
"class": "java.lang.String",
"value": "52:***:74"
},
"revision": {
"class": "java.lang.String",
"value": "15"
}
}%
I will delete it, including backup, reset pairings and cross my fingers hoping the necessary entry is created on the next start.
probably you have executed at some point "clearPairings" - it deletes the user from the homekit.json.
regarding home app configuration - you can try an OS app called "controller", it can make backup of the home app configuration. if you keep item names unchanged it should be able to restore your configuration (room assignment, icons), etc, after the pairing. however, the free version of controller app keep the backup only for 10 minutes or so.
I am afraid removing homekit.json did not help, but something interesting is happening:
Could not find existing MAC in org.eclipse.smarthome.storage.json.internal.JsonStorage. Generating new MAC. This will require re-pairing of iOS devices.
{
"privateKey": {
"class": "java.lang.String",
"value": "8N3****u003d"
},
"salt": {
"class": "java.lang.String",
"value": "-10208****533"
},
"user_1a:24:ea:76:59:c751A49592-1F72-4BA3-9487-0417208645D9": {
"class": "java.lang.String",
"value": "qt0OI****u003d"
},
"user_1a:24:ea:76:59:c7848305FE-9D54-457C-B0A2-618930779731": {
"class": "java.lang.String",
"value": "6L5s****u003d"
},
"user_1a:24:ea:76:59:c7F8D7E8B3-9C0F-431A-BF29-9B18DD68AD44": {
"class": "java.lang.String",
"value": "LJqX****u003d"
},
"mac": {
"class": "java.lang.String",
"value": "1a:24:ea:76:59:c7"
},
"user_1a:24:ea:76:59:c75C2074D5-CD72-4C4D-A92C-D590896CEE5C": {
"class": "java.lang.String",
"value": "FpdE****u003d"
},
"revision": {
"class": "java.lang.String",
"value": "2"
}
}
2020-05-23 12:37:24.195 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitLightbulbImpl@6070972e but bridge is null
2020-05-23 12:37:24.195 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitSwitchImpl@c1b3986 but bridge is null
2020-05-23 12:37:24.196 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitSwitchImpl@189c9226 but bridge is null
2020-05-23 12:37:24.196 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitLightbulbImpl@4a8e9e0f but bridge is null
2020-05-23 12:37:24.196 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitLightbulbImpl@392e433c but bridge is null
2020-05-23 12:37:24.196 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitHumiditySensorImpl@412f13ba but bridge is null
2020-05-23 12:37:24.197 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitWindowCoveringImpl@5f53198b but bridge is null
2020-05-23 12:37:24.197 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitHumiditySensorImpl@701a91e3 but bridge is null
2020-05-23 12:37:24.197 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitLightbulbImpl@ad6a956 but bridge is null
2020-05-23 12:37:24.198 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitTemperatureSensorImpl@2e67b466 but bridge is null
2020-05-23 12:37:24.198 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitTemperatureSensorImpl@d5639fb but bridge is null
2020-05-23 12:37:24.198 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitSwitchImpl@62dafb52 but bridge is null
2020-05-23 12:37:24.198 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitLightbulbImpl@258239c3 but bridge is null
2020-05-23 12:37:24.199 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitLightbulbImpl@486781a5 but bridge is null
2020-05-23 12:37:24.199 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitLightbulbImpl@5af972a6 but bridge is null
2020-05-23 12:37:24.199 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitLightbulbImpl@73a7cbc2 but bridge is null
2020-05-23 12:37:24.199 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitMotionSensorImpl@519d3b0e but bridge is null
2020-05-23 12:37:24.200 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitMotionSensorImpl@3496372d but bridge is null
{
"revision": {
"class": "java.lang.String",
"value": "3"
}
}%
2020-05-23 12:38:09.068 [INFO ] [mekit.internal.HomekitChangeListener] - Created 18 HomeKit items.
2020-05-23 12:38:09.071 [WARN ] [homekit.internal.HomekitAuthInfoImpl] - Could not find existing MAC in org.eclipse.smarthome.storage.json.internal.JsonStorage. Generating new MAC. This will require re-pairing of iOS devices.
{
"privateKey": {
"class": "java.lang.String",
"value": "yaAQg****u003d"
},
"salt": {
"class": "java.lang.String",
"value": "16668****13978"
},
"mac": {
"class": "java.lang.String",
"value": "fa:60:8c:9c:39:3c"
},
"revision": {
"class": "java.lang.String",
"value": "3"
}
}
For what it is worth, I have updated the binding to the 2.5.5 released version, but it did not help, either.
"2020-05-23 12:37:24.200 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitMotionSensorImpl@3496372d but bridge is null"
is pretty strange. please make sure you have only one instance of homekit binding running/active. no other ideas how that could happened.
ps: the users in homekit.json are the clients, so, you probably have several ios/apple tv devices and they are synced via icloud.
Thank you for continuing to help me, @yfre. Is this a sufficient test to ensure I have only one instance of the homekit binding running/active?:
openhab> feature:list | grep homekit
openhab-misc-homekit │ 2.5.5 │ x │ Started │ openhab-addons-2.5.5 │ HomeKit Integration
openhab> list -s | grep homekit
244 │ Active │ 80 │ 2.5.5 │ org.openhab.io.homekit
Thank you for explaining about the multiple users. Indeed, I have several iOS devices and a single AppleTV, with iCloud syncing.
Any other ideas what to do next, save for reinstalling everything from scratch?
yes, you have only one instance running.
im running out of ideas. i checked the source code and the only ways to get "users" removed from homekit.json are
and there is no place in the source code which would remove "mac" from the homekit.json
i have only standard advices left: unpair from iOS, uninstall homekit binding, delete homekit.json, restart everything, including iOS devices, reinstall homekit binding, pair again
Ok, I will once again uninstall homekit binding, delete homekit.json, restart everything, including iOS devices, reinstall homekit binding, pair again. This time, I will use the 2.5.6 snapshot, as I see you may have been working on a related issue #7701 / #7702
I wonder if there is any way to log more information to see what is happening prior to the removal of the user from homekit.json. Bear in mind that this issue only arises when OpenHAB shuts down, so my intuition is that OH initiates an action that leads to the loss of those entries in homekit.json.
What is the correct way to install the Homekit binding? I want to make sure I do it the right way when I have cleared the system.
For what it may be worth, I am running OH on FreeBSD. ZWave and RFXCOM are performing well now, following some debugging of nrjavaserial issues in the last few weeks.
I wonder if I am uninstalling/installing the Homekit addon correctly. I removed services/homekit.cfg from the system. I placed the current 2.5.6 snapshot .kar into the addons directory. I have cleared caches, tmp, cleared pairings, deleted from iOS Home app, shut the phone down, restarted OH.
I expected, upon restart, to see no Homekit. However, it started without me "installing" it. According to Karaf, it picked up today's snapshot version:
openhab> feature:list | grep homekit
openhab-misc-homekit │ 2.5.5 │ │ Uninstalled │ openhab-addons-2.5.5 │ HomeKit Integration
openhab-misc-homekit │ 2.5.6.SNAPSHOT │ x │ Started │ openhab-addons-2.5.6-SNAPSHOT │ HomeKit Integration
openhab> list -s | grep homekit
243 │ Active │ 80 │ 2.5.6.202005230619 │ org.openhab.io.homekit
...and it now comes with the new shorter commands like list
.
Then, I thought I would change its pin to be sure of a new association in the Home app. Since I no longer had the homekit.cfg, I decided to do that in Paper UI. When I pressed 'Save' I got this in the log:
2020-05-23 14:47:33.613 [ERROR] [org.openhab.io.homekit ] - bundle org.openhab.io.homekit:2.5.6.202005230619 (243)[org.openhab.io.homekit.internal.HomekitImpl(295)] : The modified method has thrown an exception
java.lang.RuntimeException: HomekitHttpServer can only be started once
at io.github.hapjava.server.impl.http.impl.HomekitHttpServer.start(HomekitHttpServer.java:34) ~[?:?]
at io.github.hapjava.server.impl.HomekitRoot.start(HomekitRoot.java:113) ~[?:?]
at org.openhab.io.homekit.internal.HomekitImpl.startBridge(HomekitImpl.java:150) ~[?:?]
at org.openhab.io.homekit.internal.HomekitImpl.modified(HomekitImpl.java:108) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_252]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_252]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:228) ~[bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) ~[bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) [bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317) [bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeModifiedMethod(SingleComponentManager.java:836) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.modify(SingleComponentManager.java:791) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:709) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:673) [bundleFile:?]
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:435) [bundleFile:?]
at org.apache.felix.scr.impl.manager.RegionConfigurationSupport.configurationEvent(RegionConfigurationSupport.java:316) [bundleFile:?]
at org.apache.felix.scr.impl.manager.RegionConfigurationSupport$2.configurationEvent(RegionConfigurationSupport.java:118) [bundleFile:?]
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:1709) [bundleFile:?]
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:1651) [bundleFile:?]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [bundleFile:?]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [bundleFile:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Could it be related to your hunch about multiple instances somehow running?
What is the correct way to uninstall and install this binding? Many thanks, @yfre, for your help. Homekit is the last barrier stopping me from migrating from OH1 (where I had Homekit running well over Homebridge, which is now off).
First of all, I think changing the pin to a new one, then doing the reset, may have had a positive effect. 🤞 I cannot be sure yet, but the config has survived a couple of restarts. I am now using 2.5.6 today's snapshot.
Secondly, I have noticed something odd about the revision
property that is stored in homekit.json. After the reinstall and cleaning, homekit.json had no users yet but it had a new mac. It showed revision=2. However, after doing the pairings, revision reverted back to 1:
"revision": {
"class": "java.lang.String",
"value": "1"
},
I wonder if this is the expected behaviour and if that could be related to some of the issues that I was experiencing. For example, is it possible that as we were cleaning/reinstalling, Homekit was being told that the revision number was lower than the one it expected? If so, then it would be good to make sure this number always goes up or to document that otherwise the pin needs to be changed when removing homekit.json.
Lastly, I am still lost as to why the homekit add on keeps installing itself. Even if I feature:uninstall openhab-misc-homekit
it will reinstall itself less than a minute later. I do not know what it is in the config that makes it so persistent—do you?
I will report later if and how the set-up kept on behaving, hopefully I will not lose it after the next reboots. Oh, I have downloaded the Controller for Homekit app. I need to pay €10 to get the backup functionality. If you feel it is worth it, I will—however, does it permit a partial restore, say of only the openHAB-related settings? Thanks, @yfre.
@RafalLukawiecki happy to hear that it works for you. not sure what it keeps installing itself. maybe you have it in addons folder or in service/addons.cfg
regarding controller app - in the free version you can do backup for 10 minutes. you dont need to pay for it. so, if you do major change in openHAB then it could be a good idea to make this backup. even for 10 minutes.
regarding revision: strange. we have only the logic to increase the revision and not to decrease. the only case we set revision to "1" if we cannot read it from homekit.json, e.g. homekit.json does not exists, empty or is not accessible.
i will try to re-produce your setup - i.e. have mac and revision but no users.
but in general, we send revision number to the clients on pairing and from that point, clients expects revision to get increased on changes and never get decreased. the revision number change indicates to clients that they need to request the complete configuration from the server, including meta information like device names, max/min values, etc.
@RafalLukawiecki i could not re-produce the issue with "revision" number reset. i removed the users, left everything else untouched, paired again and revision was correct.
have you experienced this issue again ? do we need this issue open or close it?
Thanks for checking with me, @yfre. I have not experienced this issue since changing the HomeKit PIN. The revision number has been incrementing correctly, and I have not experienced HomeKit resets.
I wonder if I had a combination of issues that were acting together to cause this effect. In particular, I wonder if HomeKit itself was asking to remove the pairings when it saw the revision number reset with the same PIN—but I still do not understand why the revision number was resetting...
it looks like everything is working now as expected. closing the ticket.
Hi, i can confirm. Update the key in config file and cleanup the data and cache will fix this issue.
reopen as more users have reported this issue, see https://community.openhab.org/t/re-solved-homekit-integration-pairing-problems-ios-10-11/101667/4
@bigblue1735 @RafalLukawiecki have you experienced this issue again or is everything working fine and stable now?
So far, everything has worked well for me, and the issue did not come back. I have a feeling the issue may be related to using the same Homekit pin and doing a reset of the pairing + cache clearing. When I switched to the mode of changing the PIN when doing the resets, things were OK.
Having said that, I had not needed to do a reset of any kind for a month or so, and just casually adding or removing/changing Homekit-exposed items causes no issues. I have 58 items exposed and they are all behaving very nicely.
After bundle:refresh, system reboot, or just OpenHAB service restart, Homekit binding
snapshot 2.5.5.2020051704172.5.5 using the version of OpenHAB officially released with2.5.42.5.5, repeatedly logs the following error and refuses to work. Please note, the error also has a spelling mistake, "Excepton" should say "Exception":Clearing all Homekit pairings in Karaf and re-adding them in the Home app fixes the issue, but it is not, of course, convenient, considering the number of accessories.
Does anyone have any tips how to debug it further?
PS.
smarthome:homekit allowUnauthenticated true
does not help.