So I’m completely new to all of this, just wired up the schlage/new light switches recently.
I was curious if anyone managed to come up with a script to be able to turn off all my lights when i hit the “schlage” button on the outside (hit lock), or turn the lights on only when i enter the code, but not when I unlock the door from my phone?
While I don’t know of an existing smartapp for doing it, it should certainly be feasible to do. You might need to modify the device type a bit to produce distinct events (or parse the descriptionText in the existing events.)
Check the activity stream when you lock the door manually vs the schlage button. Notice that when you do it manually, the word “manually” is in the event text. You should also see differences when you unlock with a code (vs unlock with your phone.)
Are you currently using a custom device type for the door lock? (Is it the touchscreen version?)
To be honest, I didn’t even have plans to publish that code. However, when I realized that someone else could use it, I figured I’d share it. (I really only used that app for sending myself a notification when one of my kids unlock the door and to close my garage door if I unlock the front.)
(No, I don’t use the feature for turning on a light. That was really only there to make testing a bit easier.)
Adding a day/night toggle wouldn’t be difficult, but it’s not something I can easily do until tonight or this weekend. Please send me a PM to remind me, and I’ll add it.
@garyd9 thank you for writing this code and sharing it with us, this solves a number of issues I had with Smartthings. I am wondering if it’s possible to go back to the original question the poster had and use this code or a modified version of it to trigger events based on locking the door, specifically, pressing the Schlage button to lock the door when leaving. It’d be nice to be able to trigger the Goodbye phrase when that button is pressed.
You mean to take an action on LOCKING and not UN-locking?
Yes, it’s possible. Unlike with “locking”, there are no user codes for unlocking. It’s either manual or not.
I’m not sure if there’s a way to determine the difference between locking via the “Schlage” button and locking via the app (both are electronic locking), but I can dig into it. (If I can find a difference, I’ll have to expose that via a custom device type - the existing one doesn’t differentiate. I already have a custom device type, so I can just add to that.)
Anyway, once the above issue is resolved (or not), writing a smartapp to work on LOCKing (instead of unlocking) should be trivial. Please send me PM (to remind me) and I’ll look into it.
Okay… I’ve updated my Schlage Touchscreen Lock device type code to pass through the source of a lock/unlock event. This is in preparation for doing the requested smartApp… I needed the device type to pass to the smartApps the method used for locking the door. Tomorrow I’ll whip out some code for toggling a switch when a door is LOCKED (with a filter on how it was locked.)
You should be able to use that with a virtual switch to change modes or HH events.
If you aren’t already using it, here’s the device type code:
Any chance there is code that can work with presence? If let say my wife returns home with her presence fob that ST will unlock the front door (schlage camelot) and if its night also turn on the living room lights?