Page 1 of 6

iOS9 and Homekit

Posted: 17 Sep 2015 17:28
by leonmf
I installed iOS 9 yesterday and Homekit stopped working on my iOS 9 device while continuing to work on my iOS 8 devices. I tried updating to Z-Way 2.1.1 on my Razberry to no effect.

Next, presuming that the new ease of use functions of Homekit were to blame, I tried deleting my Razzberry from my home profile and couldn't figure out how to do so.

Finally, in a fit of frustration, I deleted my home profile, created a new one and found the current HomeKit PIN in the log here: /var/log/z-way-server.log

Everything works now but I do have two outstanding questions:

1. Why did my HomeKit PIN change?
2. Why were there two different PINs in my log file that neither one matches the text file I had recorded previously a couple of months ago?
3. Am I at risk of having to regenerate my HomeKit profile every time I reboot or upgrade Z-Way?

At least everything is working. I was worried that the upgrade was going to lose me the HK functionality and I'm pleasantly surprised to find that to not be the case.

Re: iOS9 and Homekit

Posted: 18 Sep 2015 07:46
by leonmf
And... when I returned home this evening, it isn't working. It looks like I'm going to have to do some digging when I have a chance.

Re: iOS9 and Homekit

Posted: 18 Sep 2015 09:25
by pofs
1. PIN changes because it is randomly generated on every startup :)
2. Not to be confused between ambiguous log records, now valid PIN is pushed in SmartHome notifications as you press 'Identify' device in HK controller when pairing.
3. PIN has nothing to do with profile. Keys are generated once on the very first module setup, while PIN is randomly assigned on each startup. PIN is only needed for pairing and doesn't affect already paired controllers.

There's a lot of changes in HomeKit module after 2.1.1, so you might want to update to 2.1.2-rc2. It introduces a whole lot of new characteristics available, and services/characteristics mapping is completely rewritten.


P.S. If you don't see RaZberry anymore when pairing with iOS9 device, it might happen because of a single direct pairing enforcement. iOS 9 now checks state of device and doesn't allow to pair again (and vice versa, it won't even try to connect to device which reports as unpaired, even if they're paired right now).
To fix it, just disable HK module (or stop entire z-way), delete ./automation/storage/RaZberry-a5f9fbc303b7d5d74f99c840f738b01f.json file (name might vary if you use non-default accessory name), and start module (z-way) again. It will generate a new pair of keys and will be seen by HomeKit controllers as a completely new device. Now you should be able to pair again.


P.P.S. And if you are a desperate one, you might even want to update to internal rc3.
It fixes the issue with device stuck in paired state when initial accessories response contained errors and pairing was rejected by the HomeKit controller. Also it allows batch characteristics' requests, which are happening sometimes now.
But in this case you'll need to update automation folder from git, as the bundled one has a typo in HomeKit js code preventing it from start. Or just edit HomeKitGate/index.js and correct the typo (extra ; ) at line 67.

Re: iOS9 and Homekit

Posted: 18 Sep 2015 18:45
by leonmf
@pofs

Thanks for the reply.

I was able to bring homekit back online last night by deleting and re-adding my razzberry. I haven't seen the problems with it not showing up but I'm glad you've highlighted them so I don't get stuck in the future.

I'll try out the new rc this weekend.

Thanks!

Re: iOS9 and Homekit

Posted: 19 Sep 2015 06:07
by leonmf
I installed the new 2.1.2-rc2 install. 2.1.1 and prior seemed to work well with homekit and were able to find the device with no problems.

This new version, however, I have had to delete the json file you mentioned and then it shows up to add. However, trying to pair always results in a failure and then the device never shows up as available to pair again unless I delete the json file.

I'm not sure how to debug as I'm a bit out of my depth here. (It took me way to long to determine that the json file was in /opt/z-way-server/automation/storage!

Re: iOS9 and Homekit

Posted: 19 Sep 2015 21:26
by leonmf
OK, i reverted to 2.1.1 and I was able to register my homekit device. However, after several hours, my iOS9 devices just decide they can no longer reach the Homekit Gateway.

Re: iOS9 and Homekit

Posted: 20 Sep 2015 12:36
by sonoti
Hi there, I have exactly the same Problem. I'm using MyTouchHome for setting up HomeKit environment. Each time I do a complete restart of the Apple HomeKit Gateway in Z Wave and delete my homekit profile, I can find the Razberry again as an accessory and add it with a new PIN out of the z-wave logfile. Everything works fine for a few hours, then the Razberry is not found anymore...
And ideas?

Re: iOS9 and Homekit

Posted: 20 Sep 2015 12:40
by pofs
leonmf wrote:However, after several hours, my iOS9 devices just decide they can no longer reach the Homekit Gateway.
That is exactly because of a "single pairing" policy flag, which is not updated correctly in 2.1.1 release.

Regarding "unable to pair" issue, you probably have some device which translates into HomeKit accessory incorrectly. You may try to enable accessories' dump and post it here.

To enable dump, open modules/HomeKitGate/index.js and replace

Code: Select all

        	return this.accessories.serialize(r);
around line 39 with

Code: Select all

        	var tmp = this.accessories.serialize(r);
        	console.log(JSON.stringify(tmp));
        	return tmp;
and restart z-way-server. Then accessories JSON will be logged when performing pairing (even if it is unsuccessful). Copy that line from the log and post it here.

Re: iOS9 and Homekit

Posted: 20 Sep 2015 13:58
by sonoti
Seems that following solved my problem (at least now running for nearly 2 hours):

- stop HomeKit Gateway in Z-way
- del Homekit Profile in iOS
- on Raspberry delete /opt/z-way-server/automation/storage/RaZberry-a5f9fbc303b7d5d74f99c840f738b01f.json (or similar)
- start HomeKit Gate again
- Pair RaZberry again in Homekit (with new pin)

let's see how long it will do.

Re: iOS9 and Homekit

Posted: 20 Sep 2015 14:44
by sonoti
Did not work, HomeKit stopped again, could not be found from iOS device any more.
pofs wrote: Then accessories JSON will be logged when performing pairing (even if it is unsuccessful). Copy that line from the log and post it here.
Where will I find the log then?