Closed jadedeane closed 8 years ago
Same issue here with the Danalock. I can lock/unlock it with Siri just fine, but using a HomeKit app I have to toggle the target state a few times before it actually does anything.
Edvard;
On Sat, Jul 30, 2016 at 5:36 AM, moosebert notifications@github.com wrote:
Have a couple Kiwkset locks successfully linked-up with Z-Way, but when presented to Homebridge as accessories they’re constantly showing “unlocking” (in iOS 10’s new Home app), and in a “Lock Mechanism Target State” of “Unsecured” constantly (despite being locked).
I’m able to lock/unlock them (with a valid state update) via Z-Way without issue. It’s only via Homebridge that this funky “always unlocking” state appears.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SphtKr/homebridge-zway/issues/44, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWZB2ShMQM9xxUredH8HqrPSywFWzdWks5qasa-gaJpZM4JYtxX .
Think I'm onto something here.
So on line 1142 of index.js val
is declared with a default value of "0". If vdev.metrics.level
returns "open", it should be set to "0" and conversely if "closed" is returned set to "1". Did a little debugging, and at least with Z-Way 2.2.3 (only version I've ever used) if a lock is secured (e.g. "closed") vdev.metrics.level
actually returns "close", ergo no match so val is never changed from "0".
Changed the code around simply like this and things are working as expected now:
if(cx instanceof Characteristic.LockTargetState){
cx.zway_getValueFromVDev = function(vdev){
var val = Characteristic.LockTargetState.UNSECURED;
if(vdev.metrics.level === "open"){
val = Characteristic.LockTargetState.UNSECURED;
} else if(vdev.metrics.level === "closed") {
val = Characteristic.LockTargetState.SECURED;
} else if(vdev.metrics.level === "close") {
val = Characteristic.LockTargetState.SECURED;
}
debug("Returning LockTargetState of \"" + val + "\" because vdev.metrics.level returned \"" + vdev.metrics.level + "\"");
return val;
};
Will submit a commit eventually on the above once I've researched more and validated it's the right approach.
Last issue is the status never changes within homekit after a successful lock/unlock (with the above issue resolved). Not sure if homebridge-zway should be kicking Z-Way server to update, or if Z-Way server should be querying the device for the update on its own, but started a thread over on Z-Way forum https://forum.z-wave.me/viewtopic.php?f=3419&t=23601.
Resolved the "last issue" which has nothing to do with homebridge-zway. Details at https://forum.z-wave.me/viewtopic.php?f=3419&t=23601 (use https://github.com/jensmoes/Niffler app).
With submitted commit this should be resolved.
@Zyg0te take a look at the aforementioned commit, and app. Combo of these should solve your issues too I hope!
@moosebert Thanks for looking into this. I have no experience with npm packages. How can I try out your commit exactly?
@archpoint you can simply alter /usr/lib/node_modules/homebridge-zway/index.js
on your box as described in this thread. Alternatively, replace aforementioned file with https://github.com/moosebert/homebridge-zway/blob/master/index.js.
@moosebert Gave it a go now. Works perfectly. Thank you.
@moosebert , Great! Thanks... I got my DanaLock but haven't installed it yet so couldn't test (finally ordered the right cylinder so it's on its way now). Can you submit this as a pull request?
@SphtKr my pleasure dude, thanks for all the hard work. Aforementioned "fix" can be found in pull req. #45
Have these changes been rolled into the latest v0.5 alpha (3)? From a cursory glance it seems to be but the code is not exactly the same as what's described above. I've also setup Niffler in my ZWay server but I'm not sure it's updating status correctly for my Danalock v2 BTZE. Home app on my iPhone always shows "Unlocking..." except for a few seconds after I try to lock the door, then it switches back. How can I verify that the ZWay + Niffler combination is working before I start debugging homebridge-zway?
No, these changes were added after 0.5.0-alpha3. Try updating to the latest (0.5.0-alpha4).
That did the trick (upgrading to 0.5.0-alpha4)! The status of my Danalock is now correctly updated in HomeKit.
Have a couple Kiwkset locks successfully linked-up with Z-Way, but when presented to Homebridge as accessories they’re constantly showing “unlocking” (in iOS 10’s new Home app), and in a “Lock Mechanism Target State” of “Unsecured” constantly (despite being locked).
I’m able to lock/unlock them (with a valid state update) via Z-Way without issue. It’s only via Homebridge that this funky “always unlocking” state appears.