I’d like to share my first steps with SmartThings in case it is of value to someone in the same situation.
- only one lock to manage
- very limited number of users to manage, with little changes, and access always granted
- interest in being notified when the door is locked/unlocked. Notification should tell me who unlocks the door
I got the Yale YRD256 with z-wave module for its aesthetic and compatibility with ST. After installing it, I started playing with ST. Here are the steps I went over, issues I encountered and what I learned along the way:
Mobile app setup
It was probably the most confusing part of this project. There are 2 mobile apps out there, SmartThings Classic and SmartThings ( the most recent one). Bottom line: SmartThings classic, as of right now, is the way to go. The new app is not ready yet as it does not have feature parity with the classic app. It is all explained on ST FAQ here: https://support.smartthings.com/hc/en-us/articles/360000114006-New-SmartThings-app-FAQ
After pairing the device, the only capabilities I had were to lock and unlock the device, and to see battery level. Not enough to call it done.
This article was very helpful to know what my options were: New to Smart Things need help managing Schlage lock user codes. There are 3 of them: rboy’s paying solution, ethayer’s free solution, and smartthings Smart Locks solution.
After a bit of reading, I decided to try the full featured, yet free, solution from ethayer first.
Playing with ethayer’s lock manager Bottom line, ethayer’s solution is too much for my need. But I still learned a lot which allowed me to move on. Here are more details:
I think this is where things got fun. Ethayer’s app installation is very well explained ( see [RELEASE] Lock Manager ). Here are the little tricks I learned when setting it up:
- When you go to the developer portal ( http://graph.api.smartthings.com/ ), make sure to go to “My Locations” and click on your location so that you get redirected to the proper server. Otherwise, your devices will not show up.  as mentioned in the replies below, it is best to use https://account.smartthings.com instead of the graph api link to get to the correct server.
-  From replies below, I was mistaken. Rebooting the hub should not be needed. [/edit] From what I observed, when installing a new device handler and assigning it to a device, it is best to reboot the hub. No need to get off your chair to do it, go to “My Hubs” -> view utilities -> reboot hub. I did have issues at some point of not being sure which device handler was being used, and I suspect some of the issues I encountered were related to that.
- I used the github integration, but I did not like that it was giving access to all the repositories my account has access to, including private organizations and repositories. I decided to create another github account just for that purpose. You could also add the device handler and apps using code only to avoid the setup.
Once installed, I was able to setup users, locks, add code, set notifications. I almost had all I wanted. The reasons I was not satisfied were:
- notification were not telling me who was opening the door. Every event was sent with “Code 99”.
- the notification setup with 3 level ( global, locks, users ) was a bit confusing, and I honestly did not know what behavior I would end up getting at the end. From my testing, I was not consistently being notified.
This is when I decided to go in another direction. I did consider rboy’s solution, but the problem is, it is hard to see what you will get after you pay for it. The functionalities are all listed on rboy’s website, but there are no screenshot or anything to gauge usability. This is why I decided to pursue the other free solution, Smart Locks from ST.
Smart Locks from ST
ST has a smartapp that give you more control over smartlocks: https://support.smartthings.com/hc/en-us/articles/200958090-Smart-Locks-in-SmartThings-Classic
Setup was easy. I changed the device handle back to the stock “zwave lock” handler. But I had errors when trying to add codes using Smart Locks. I cannot fully explain why because I took 2 actions that could have independently resolved the issue, but do not know which one did:
- I rebooted the hub to make sure z-wave lock device handler was the one being used for the lock
- I cleared all the user codes created with lock manager
After that, I was able to add user codes, lock/unlocked, see the lock history in Smart Locks. It was not the end of the journey though. Smart Locks does not send notifications, and I was also getting “Code 99” in the history tab of Smart Lock, while I expected the name of the person activating the lock.
Diving into the device handler
I decide to first tackle the “Code 99” issue. I figure it was coming from the device handler. I proceeded by creating my own device handler using the code of the ST one ( https://github.com/SmartThingsCommunity/SmartThingsPublic/tree/master/devicetypes/smartthings/zwave-lock.src ). Thanks to having gone through ethayer’s guide, it was easier to understand how to create a device handler, associate it with the device.
To my surprise, just by using the latest version of zwave-lock device handler, the Code 99 issue that I was having with both ethayer’s handler and default zwave-lock got resolved. To my knowledge, this indicates that both are outdated and do not contain the latest fixes and improvements.
So at that point, I could lock, unlock, add user codes, and I could see in the Smart Locks history who was locking/unlocking the lock. Great! Still no notifications. This is when I decided it was time I write my own SmartApp to get the behavior I need.
I used the “From form” dialog to create the app, and start with a blank slate. I also referred to the following for inspiration:
- someone went through the trouble of writing this, which was helpful to understand syntax and logic on how to code an app leveraging the lock’s events: https://github.com/SmartThingsCommunity/SmartThingsPublic/tree/master/smartapps/lock-auto-super-enhanced/enhanced-auto-lock-door.src
- google! Any time I needed something, googling “smartthings something” always gave me useful result, either from this community site or from the official documentation ( http://docs.smartthings.com/en/latest/ )
- the simulator is such a great feature. It allowed me to troubleshoot and test the behavior of the app right from the web editor, either using a virtual lock, or my own lock.
- this post was also a great source of info on how to debug what was happening: FAQ: Logs and SmartThings - An intro into figuring out what went wrong
After some trial and errors, I created and published my own app, which allows me to send notification when someone locks/unlocks the door, and to send me a reminder after N minutes if I left the lock unlocked. Last step was to link the smartapp to a github repo I created, and to commit the changes, for ease of sharing: https://github.com/mperceau-pub/smartapps/commits/master/smartapps/mperceau-pub/lock-notification.src
This is the end of this first project using SmartThings for the YRD256 lock. I hope it will be useful to others, in the same way a lot of articles posted here were useful to me. Please let me know if you have any feedback!