iOS9 and Homekit

Discussions about Z-Way software and Z-Wave technology in general
leonmf
Posts: 44
Joined: 23 Oct 2014 02:59

iOS9 and Homekit

Post by leonmf » 17 Sep 2015 17:28

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.

leonmf
Posts: 44
Joined: 23 Oct 2014 02:59

Re: iOS9 and Homekit

Post by leonmf » 18 Sep 2015 07:46

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.

pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: iOS9 and Homekit

Post by pofs » 18 Sep 2015 09:25

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.

leonmf
Posts: 44
Joined: 23 Oct 2014 02:59

Re: iOS9 and Homekit

Post by leonmf » 18 Sep 2015 18:45

@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!

leonmf
Posts: 44
Joined: 23 Oct 2014 02:59

Re: iOS9 and Homekit

Post by leonmf » 19 Sep 2015 06:07

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!

leonmf
Posts: 44
Joined: 23 Oct 2014 02:59

Re: iOS9 and Homekit

Post by leonmf » 19 Sep 2015 21:26

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.

sonoti
Posts: 4
Joined: 20 Sep 2015 12:31

Re: iOS9 and Homekit

Post by sonoti » 20 Sep 2015 12:36

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?

pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: iOS9 and Homekit

Post by pofs » 20 Sep 2015 12:40

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.

sonoti
Posts: 4
Joined: 20 Sep 2015 12:31

Re: iOS9 and Homekit

Post by sonoti » 20 Sep 2015 13:58

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.

sonoti
Posts: 4
Joined: 20 Sep 2015 12:31

Re: iOS9 and Homekit

Post by sonoti » 20 Sep 2015 14:44

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?

Post Reply