Jump to content

Door Lock Syncing


Recommended Posts

I have recently added 3 schlage be469 zwave locks to my home.  They installed and were recognized by my ISY very easily.  (Very Happy)

 

What I want to know is if there is a way so sync the user codes between the locks?  I would prefer to not have to change the code on all of them if I need to change mine or one of my family members codes.  Can anyone suggest anything?

 

post-4839-0-43754100-1422199337_thumb.jpg

Link to comment
Share on other sites

However, it is not difficult to manage the codes via the ISY console.

 

-Xathros

I know its not difficult, but impossible to tell what Users have codes set.  

 

I'd like to possible see an outside application that can be used to write users to all of the deadbolts.   Would this be possible via the API?

Link to comment
Share on other sites

  • 2 weeks later...

I believe I have found a way to do this via the API.  

 

Does anyone know what the REST uri is for clearing a door lock code it?

 

The following is used for setting the lock but I can not find the clear uri:

/node/<nodeAddress>/security/user/<userNum>/set/code/<code >

Link to comment
Share on other sites

After a little experimentation I found the uri for removing a code from the lock.

/node/<nodeAddress>/security/user/<userNum>/delete

 

I was able to put together a program on a local machine.  I have a program that pulls a list of users I have setup as variables on the ISY as codes for the locks.  I take those variables and run them through a program that sets the lock codes for each door lock.  

 

Works great.

 

Hopes this helps someone someday.

Link to comment
Share on other sites

Hi James,

 

I have only one BE469 so it is rather easy to manage however it is great to hear you solved the mystery of managing the user codes amongst several locks. Thanks for sharing the result as it must have been time consuming to get there!

 

~Mike

Link to comment
Share on other sites

After a little experimentation I found the uri for removing a code from the lock.

/node/<nodeAddress>/security/user/<userNum>/delete

 

I was able to put together a program on a local machine.  I have a program that pulls a list of users I have setup as variables on the ISY as codes for the locks.  I take those variables and run them through a program that sets the lock codes for each door lock.  

 

Works great.

 

Hopes this helps someone someday.

Nice work.  Thanks for sharing.

 

-Xathros

Link to comment
Share on other sites

  • 5 months later...

woof, this is an arcane forum/bb :)  just submitted a detailed reply, and was 'DENIED'... had to sign in... would have been nice to have NOT been allowed to compile a response if I wasn't signed in... but ANY-HOO 

 

I think my question was to James Peterson... is the URI you specified not quite accurate or is the point that the ISY API documentation needs updating?

 

Because the typical path is /rest/nodes/<address>/...    so, if your URI worked, then I'm wondering if there's some URI path syntax that's wrong with my trying to do a simple value set to unlock/lock the door

 

I have a Kwikset "Smartcode 916" that also has user codes and even a schedule... so would be handy to manage codes via my api wrapper.

 

See this gist where I can query, but not set a z-wave object's variable

Link to comment
Share on other sites

@PurdueGuy: yeah, I figured it out about 45minutes ago.. had to use SECCMD.. was reading another forum about the case-sensitive inconsistency of the elements in the REST URI.. and then found what I needed by RTFM.

 

Can open and close the Kwikset Smartcode 916 devices until the cows come home with : /rest/nodes/ZW017_1/cmd/SECMD/1 

 

Now futzing with how to list/show configured users, doesn't appear possible (so far), although I can set/delete them just fine with the URI '/rest/zwave/node/ZW017_1/security/user/1/set/code/<code>' 

'/rest/zwave/node/ZW017_1/security/user/1/delete'

 

however, you can't reset an existing users code with just 'set'... you'll have to 'delete' then 'set' 

 

I still don't see how one can lists the users and codes as @james.peterson does... I suspect he has a source that he's using to rebuild the users on each device, as opposed to "syncing" from one device to the next. 

Link to comment
Share on other sites

Can you... use the network module to do these rest queries against the ISY itself?

I'm not sure what you mean as all these queries ARE against the ISY unless your talking about seting up a Network Resource to make an http request to the API... which surely you can do.

Link to comment
Share on other sites

  • 4 months later...

@PurdueGuy: yeah, I figured it out about 45minutes ago.. had to use SECCMD.. was reading another forum about the case-sensitive inconsistency of the elements in the REST URI.. and then found what I needed by RTFM.

 

Can open and close the Kwikset Smartcode 916 devices until the cows come home with : /rest/nodes/ZW017_1/cmd/SECMD/1 

 

Now futzing with how to list/show configured users, doesn't appear possible (so far), although I can set/delete them just fine with the URI '/rest/zwave/node/ZW017_1/security/user/1/set/code/<code>' 

'/rest/zwave/node/ZW017_1/security/user/1/delete'

 

however, you can't reset an existing users code with just 'set'... you'll have to 'delete' then 'set' 

 

I still don't see how one can lists the users and codes as @james.peterson does... I suspect he has a source that he's using to rebuild the users on each device, as opposed to "syncing" from one device to the next. 

 

Here is the exact code I am using.  I set users up a vars in the ISY and give them values of there code.  The program pulls those values and sets the locks.  I would have replied sooner, but i didn't get a notification of the additional posts.

#!/usr/bin/perl

use strict;

use Device::ISY;
use Device::ISY::Credentials;
use Device::ISY::Constants;
use Device::ISY::EventLogger;
use Device::ISY::Discover;

my $isy_addr = "11.11.11.11";
my $username = "XXXXXXX";
my $password = "XXXXXXXX";
my @DoorLocks = ("ZW007_1","ZW008_1","ZW011_1");
my $MAXCODES = 10;
my $MINCODELENGTH = 4;

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

my $creds = Device::ISY::Credentials->new($isy_addr, $username, $password);
my $isy = Device::ISY->new(address => $isy_addr,
        credentials => $creds,
        watch => 0,
        use_rest => 1);

sub isy_del_lock {
        my $isy = shift;
        my ($name, $user) = split(/:/, shift);

        my $twig = $isy->get_rest_result("nodes/$name");

        if($twig != '' and $user =~ /\d+/ and $user < 15 and $user > 0) {
                my ($success, $status, $twg) =  $isy->get_rest_result("zwave/node/$name/security/user/$user/delete");

                if (! $success) {
                        printf STDERR "Setting doorlock '%s': %s\n", $name, $status;
                        print $isy->twig_parse_object($twig)->{'nodeInfo'}."\n";
                        print "$success\n";
                        print "$status\n";
                        print "$user\n";
                        return;
                }
        }

        return;
}

sub isy_set_lock {
        my $isy = shift;
        my ($name, $user, $code) = split(/:/, shift);

        my $twig = $isy->get_rest_result("nodes/$name");

        if($twig != '' and $user =~ /\d+/ and $user < 15 and $user > 0 && $code =~ /\d+/ && length($code) == 4) {
                my ($success, $status, $twg) =  $isy->get_rest_result("zwave/node/$name/security/user/$user/set/code/$code");

                if (! $success) {
                        printf STDERR "Setting doorlock '%s': %s\n", $name, $status;
                        return;
                }

        }

        return;
}

sub isy_variables {
        my $isy = shift;
        my @doorUsers;

        my $result = $isy->get_rest_result("vars/get/1");

        foreach my $var ($result->get_xpath("var")) {
                my $varname = $isy->var_name(1,$var->{'att'}->{'id'});
                if ($varname =~ /user_/) {

                        push @doorUsers, $var->first_child('val')->text;

                }
        }
        return @doorUsers;
}

if ($wday == 0) {
        for (my $i = 0; $i < $MAXCODES; $i++) {
                foreach my $door (@DoorLocks) {
                        isy_del_lock($isy,"$door:$i");
                        #print "$door:$i\n";
                }
        }
}

my $c = 1;
foreach my $code (isy_variables($isy)) {
        while (length($code) < $MINCODELENGTH) {
                $code = "0".$code;
        }
        foreach my $door (@DoorLocks) {
                isy_set_lock($isy,"$door:$c:$code");
                print "$door:$c:$code\n";
        }
        $c++;
}
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...