Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock states always "unlocking"/"unsecured" #44

Closed
jadedeane opened this issue Jul 30, 2016 · 11 comments
Closed

Lock states always "unlocking"/"unsecured" #44

jadedeane opened this issue Jul 30, 2016 · 11 comments
Milestone

Comments

@jadedeane
Copy link
Contributor

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.

@ardevd
Copy link

ardevd commented Jul 30, 2016

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
#44, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAWZB2ShMQM9xxUredH8HqrPSywFWzdWks5qasa-gaJpZM4JYtxX
.

@jadedeane jadedeane changed the title Kwikset lock state always "unlocking"/"unsecured" Lock states always "unlocking"/"unsecured" Jul 30, 2016
@jadedeane
Copy link
Contributor Author

jadedeane commented Jul 31, 2016

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.

@jadedeane
Copy link
Contributor Author

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!

@ardevd
Copy link

ardevd commented Aug 12, 2016

@moosebert Thanks for looking into this. I have no experience with npm packages. How can I try out your commit exactly?

@jadedeane
Copy link
Contributor Author

jadedeane commented Aug 13, 2016

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

@ardevd
Copy link

ardevd commented Aug 13, 2016

@moosebert Gave it a go now. Works perfectly. Thank you.

@SphtKr
Copy link
Owner

SphtKr commented Sep 5, 2016

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

@jadedeane
Copy link
Contributor Author

@SphtKr my pleasure dude, thanks for all the hard work. Aforementioned "fix" can be found in pull req. #45

@SphtKr SphtKr closed this as completed in b412c51 Sep 11, 2016
SphtKr added a commit that referenced this issue Sep 11, 2016
Proposed LockTargetState condition match and fixes #44
@Fingerz
Copy link

Fingerz commented Oct 9, 2016

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?

@gijoecool
Copy link
Contributor

No, these changes were added after 0.5.0-alpha3. Try updating to the latest (0.5.0-alpha4).

@Fingerz
Copy link

Fingerz commented Oct 9, 2016

That did the trick (upgrading to 0.5.0-alpha4)! The status of my Danalock is now correctly updated in HomeKit.

@SphtKr SphtKr added this to the 0.5.0 milestone Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants