(Enhanced) Z-Wave Schlage Touchscreen Lock


(Gary D) #1

UPDATED August 22nd, 2015 (see below)

As promised elsewhere, here’s my device type for the Schlage touchscreen door lock/deadbolt.

This enables querying and setting the door alarm (off/alert/tamper/kick), door alarm sensitivity, and auto-lock modes. (There’s also support for lock/leave and vacation mode, but I don’t have them on the config panel yet.)

One thing about this lock is that it’s a SLOW device in z-wave terms. The turnaround time for sending a command and getting a response can be several seconds. So, if you are using this, you’ll notice that trying to change, for example, the alarm mode, will result in the tile going blank with the word “loading…” in it… and then it populating a few seconds later.

When changing the alarm MODE, the alarm sensitivity must be re-queried (as the lock has a different sensitivity for each alarm mode.) So, tap “alarm mode”, and it’ll take a good 10 seconds before both tiles are fully updated on the config panel.

The alarm sensitivity is implemented as a “Slider” control… which leads to some oddities. (The slider requires a range between 0 and 99. The sensitivity is a number between 1 and 5. I did some scaling…)

The “refresh” button will refresh the lock state, alarm mode, and sensitivity, but not any other new titles. If you have a tile showing “loading…” and you want a real value, tap the tile and it should refresh that config setting in a few seconds.

TODO:
pfft… read the code. Around line 523 you can see where the config values are parsed. Each of them can be implemented (but some don’t make sense, and others aren’t really useful.) You can see where I was testing the various config values if you just to the refresh command implementation (around line 834)

One other thing I’ve done here is to pass events with an “eventType” of “ALERT” in the case of important alarms. You know, like someone trying to break into your house, or a lock being jammed. The idea is that some smartApp can subscribe to those events (subscribe(door, “eventType”, evtHandler)) to push notifications. (I have it working on mine, but that code is embarrassing… )

This isn’t done by any means. It’s just the start of what I’m doing.

So, before you install this, remember that YOU are installing it. I’m not installing it on your stuff. If anything undesirable happens as a direct or indirect result of this stuff, you take FULL responsibility and won’t blame me in any way.

Pay attention to the licensing terms at the top of the file. I’m giving this stuff out freely - don’t return the favor by spitting in my face.

I’m testing and developing this with a Schlage touchscreen deadbolt. Most of the stuff won’t work with anything that isn’t Schlage. I dont’ even know if it would work with a non-touchscreen device. Let me know if it does. :wink:

So… how to plug it in…

Go to the github link above, and click the “raw” button (next to “blame” and “history”.) That’s the raw code that you want to copy.

Go to your ST dev account at ide.smartthings.com. Login (or create your account and login.)

Go to “my device types.”

Click the green button on the right that says “New SmartDevice.” (I know someone at ST is going to change the layout of the website now… just to make me edit this.)

Click on “From Code.”

PASTE the stuff you copied from my github account (the raw code!) into this big empty text editor, and then click “Create”

Now you can “save”, and “publish”->“For Me”


Now, all you need to do is go to “my devices”, click on your existing z-wave door lock, click “edit”, and change the device type to this new “z-wave schlage touchscreen lock”.

After that, you might have to kill and restart the mobile app for the changes to be visible.

Update: 2015-02-02 : changed state values to prevent UI confusion. (Previously, when setting one item to ‘unknown’, the UI might show ALL the items as ‘unknown’.) Also added beeper toggle.

Update: 2015-03-07: Just in time for DST! When the lock gets locked/unlocked manually, automatically, or from the keypad (with no keycode - such as locking via the schlage button), include information in the usedCode data indicating the source of the event. The only time this won’t be populated is when the locking/unlocking from a z-wave command.

Update 2015-08-22: I merged all the changes from the ST “z-wave lock” device type back into this device type. This seems to add a couple bug fixes as well as changes to security related stuff. The device type is also mostly compatible with Erik Thayer’s “lock code manager” smart app. (However, there are a few change requests I’ve made to Erik that would make the compatibility a bit better.)


Schlage Deadbolt management?
Zwave locks/nexia/smartthings
Door (Un)Lock Triggers (v2)
[Depricated] Lock Code Manager
Sonos Lock Smart App with Delay
New to ST and have Camelot connect deadbolt locks when leave unlocks 10 minutes later
Schlage Nexia Lock Remote Administration
[Depricated] Lock Code Manager
[RELEASE] Lock Manager
[Depricated] Lock Code Manager
Schlage Camelot Touchscreen Deadbolt battery life always 100%
[RELEASE] Universal Enhanced Z-Wave Lock, Schlage, Yale, Kwikset, IDLock, DanaLock, August Pro, Samsung, Locstar, KeyWe Locks and Popp Z-Wave Keypad Device Handler with Alarm Control, Notification, RFID, Door Sensor and advanced features
Schlage Z-wave Lock Command Works Occasionally
FAQ: Best/Most Stable door lock?
[Depricated] Lock Code Manager
What do you guys think is best ST compatible smartlock currently?
Changing Lock Codes Remotely?
Suggestions for when cleaning service comes over?
Schlage Camelot control lights
Schlage Nexia Lock Remote Administration
[RELEASE] Universal Enhanced Z-Wave Lock, Schlage, Yale, Kwikset, IDLock, DanaLock, August Pro, Samsung, Locstar, KeyWe Locks and Popp Z-Wave Keypad Device Handler with Alarm Control, Notification, RFID, Door Sensor and advanced features
(Mark) #2

@garyd9 Awesome! Thank you so much for all your work Gary. It is working great. I will play with it and let you know if I notice anything.


(Jeff DeWolfe) #3

Agreed, THANK YOU! Will grab the code and try out the device type this weekend. Will let you know my experience!

Thanks again!!!
Jeff


(Gary D) #4

Keep an eye on this thread… I’ll post replies when I update the code. It is, after all, a work in progress.


(Tim Slagle) #5

I love your license/copyright statement!


(Gary D) #6

I suppose I should explain that…

At one time, I was very active in android related development. (Not writing standalone apps, but OS level and kernel dev.) More than once I’ve had people take my stuff (without my blessings) and fold it into commercial or “for profit” stuff. (One even taking a compiled version of my code, and basically saying “look what I did! If you like it, send me a paypal donation!”)

I don’t do android code for profit, donations, or anything else. I do it for myself and to to share with people. I’m taking the same idea to my ST dev. I’m doing the work for ME. I’m then sharing that with other people. It’s a hobby. On the other hand, I don’t want people to take my work and profit from it. To me, that’s unethical and even illegal - and completely disregards the spirit of sharing.

Of course, others do work “for profit”, and I fully support that as well. Hey, I make a living developing for my employer, and they make profit from my dev work (but that’s all Windows and non-android linux work.)

The difference? Well, someone else already pointed it out. I do this for me first. If I don’t have a device, or find some feature unimportant for my own use, I won’t use my (extremely rare) free time to implement it. I’m not obligated to anyone for any of this, and one day when I get bored with it, I’ll just walk away. (Of course, being that I’m sharing all source, it should be trivial for someone else to pick it up - as long as they are willing to also share.)

Finally, as “SmartThings” owns the copyright to the original work, and they are sharing it with us freely, I feel obligated to give them my mods if they want them - without conditions. They are the only entity that could “take” my code. Of course, my modifications would be fairly useless without theirs as the baseline.

Take care
Gary


(Dawn Fairbro) #7

Gary,
Thank you so much for your detailed description of how to install the app. It truly helps those of us who are just basic users to install and use the great things that we see here. Thanks again :smiley:


(Gary D) #8

updated:

added the rest of the basic attributes and commands. cleaned up formatting (and brace style.) commented out the code that actually sets a PIN number as it can be dangerous (it will delete all existing PIN codes.)


(Gary D) #9

Some random comments…

I noticed that when I added several standard tiles to the details screen, all with possible “on”, “off”, “unknown” values, that if I changed the value of any one of them to, for example, “unknown”, that all of them would APPEAR to be set to unknown. Same with “on” and “off.” It was driving me nuts thinking that I was setting all the stupid tiles off and screwing up my settings.

If you get strangeness like this on your device, just back out of the details page and then go back into it… things should look proper again.

Also, you can view your settings on the ST website. Go to “ide.smarthings.com”, login, select “my devices” and then select the door lock thing. I bit more than half-way down, you’ll see a section called “Current States.” that should show you the current state of all the settings.

The alarm sensitivity is scaled from 1-5 to 1-99. To convert from what you see on ide.smarthings.com, use this formula: actual_sensitivity = ( x / 20) + 1 // (where “x” is the value on the website.)

Once I figure out the issue mentioned above (about the tiles showing strangely), I’ll probably add the rest of the settings as tiles. (All the code is there already)


(Ken) #10

@garyd9, thank you so much for this! You are bringing me closer to not missing the Nexia system when it comes to the lock control. It’s members like you and @wackware and many others that make owning Smartthings worth it.


(Mcvoss) #11

@garyd9, THANK YOU for this, awesome job… I can’t wait until the rest of the code is implemented.


#12

Anyone try this code with the Schlage Camelot? I would like to add some actions based on what code was used for entry.


(Gary D) #13

Which one? “Camelot” is kind of a trim style. If it’s the touchscreen z-wave model that looks like the one in the link below, then yes, it works fine with that.

edit: nice that a link to smartthing’s own product page messes up on smartthing’s forum. Here’s another link to amazon: http://www.amazon.com/Schlage-Connect-Touchscreen-Deadbolt-BE469NXCAM619/dp/B00AGK9KOG


#14

Yep, that is it!

Seems to be working. How might one setup a smart app to fire off events when a user enters using a specific code? It looks like your code has that capability but an example would be very much appreciated. Also, any idea how one might restrict a certain code for entry only during specified times/days of the week?

Thanks!


(Gary D) #15

Restricting codes (or changing codes) based on a schedule - nothing has been written for that as yet.

As for notifying or doing something based on a user enters, feel free to take this code and play with it. I use it to close my garage door when I put my code in the door, and to send me a notification when one of my kids uses their codes to unlock the door. (So I know when they get home from school.) This code is in really rough shape and has a bunch of debugging stuff in it. (I also use this particular smartapp to debug ideas, as you might notice from the source. You should probably clean it up.)

[code]/**

  • Door Unlock Triggers
  • Copyright 2015 Gary D
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.

*/
definition(
name: “Door Unlock Triggers”,
namespace: “garyd9”,
author: “Gary D”,
description: “Triggers switches, door controls, etc based on lock events”,
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {

section("When a door unlocks...") {
	input "lock1", "capability.lock", title: "Door Lock?", required: true
	input "mySwitch", "capability.switch", title: "Switch? (for debugging)", required: false
}

section("And this user code opened the door:") {
	input "User1", "enum", title: "User Code", metadata:[values:["1","2","3","4","5"]]
}
section("Then..."){
	input "doors", "capability.doorControl", title: "Close these doors", multiple: true, required: false
	input "switches", "capability.switch", title: "Turn on these switches", multiple: true, required: false
    input name: "sendPush", type: "bool", title: "Push notification to mobile devices?", defaultValue: false
}

}

def installed() {
log.debug “Installed with settings: ${settings}”

initialize()

}

def updated() {
log.debug “Updated with settings: ${settings}”

unsubscribe()
initialize()

}

def initialize() {
// TODO: subscribe to attributes, devices, locations, etc.
subscribe(lock1, “lock.unlocked”, lockHandler)
subscribe(mySwitch, “switch”, switchHandler, [filterEvents: false])

log.debug "about to subscribe to command..."
subscribeToCommand(mySwitch, "on", switchOnHandler)

}

def performActions(evt)
{
doors.eachWithIndex {s, i ->
def state = s.latestValue(“door”)
if (state == “open”)
{
log.debug "$s is currently $state. Closing it."
s.close();
}
else
{
log.debug “$s is currently $state. (can’t close it)”
}
}

switches.eachWithIndex {s, i ->
    def state = s.latestValue("switch")
    if (state == "off")
    {
        log.debug "$s is currently $state.  Turning it on."
        s.on()
    }
    else
    {
        log.debug "$s is already $state."
    }
}
if (sendPush)
{
	sendPushMessage(evt.descriptionText)
}

}

def lockHandler(evt)
{
if (evt.data == null)
{
log.debug “evData is null”
}
else
{
def evData = parseJson(evt.data)
log.debug “evData.usedCode: ${evData.usedCode}. Attempting to find user $User1"
if (”${evData.usedCode}" == “$User1”)
{
log.debug User1 + " unlocked the door!"

		performActions(evt)
    }
    
}

}

def switchHandler(evt)
{
// performActions(evt)
log.debug “switchHandler ${evt.value}”
}
def switchOnHandler(evt)
{
log.debug “switchOnHandler ${evt.inspect()}”
}
[/code]


(Gary D) #16

Updated code:

2015-02-02 : changed state values to prevent UI confusion. (Previously, when setting one item to ‘unknown’, the UI might show ALL the items as ‘unknown’.) Also added beeper toggle.


(Hugo Donis) #17

Hey @gartd9

Thanks for sharing your great work.

Would you be able to tell me if this GE On/Off wall switch will work as a repeater for the Schlage lock? I know it requires Beaming service but I cant seem to find any devices that say it directly.

I’m hoping the number highlighted in yellow represents the firmware.


(Gary D) #18

I’m not sure which devices support beaming and which don’t. Sorry.


(Hugo Donis) #19

Do you know if there’s a way to avoid having to press the “Schlage” button on the touchscreen before typing in your passcode?

I was hoping the keypad would just light up regardless of where you touched it.


(Gary D) #20

I don’t know of any way, but there’s a very positive aspect to it: It likely saves a considerable amount of battery power to have only that one part of the touchscreen active ALL the time, and also prevents most accidental (environmental) activations of the entire unit.