So, I now have working prototypes of a SmartApp I call “Delayed Entry” and a Device Handler for a Virtual Switch I call “Simulated Door Sensor”. What I would like from the folks here is some input on which method you think is better for my custom solution to the delayed entry shortcomings of the built in Smart Home Monitor (SHM) solution in SmartThings.
Option 1) - Custom SmartApp “Delayed Entry” and custom Device Handler for Virtual Switch
The problem with using a virtual switch in SHM is you can’t select it as a sensor to monitor. I added the sensor and contact sensor capability to handle that. I also whipped up a quick SmartApp to control it instead of using something like the Smart Lighting app. The problem with Smart Lighting is that even though you can have a Virtual Switch follow a sensor, if you shut the door, then the virtual switch will close on it’s own. This app will send the on() command to the virtual switch after you open a contact sensor based on your set delay time. Then, it will automatically close it back (if you want) after a set delay. The catch is, the app will not turn the switch off when you close the contact sensor. It either stays open requiring manual reset or automatically closes AFTER it’s open. That way the bad guy can just shut the door behind him.
Option 2) - Getting Fancy with the Device Handler and use Published App
In addition to adding the contact sensor capability to the device handler for the Virtual Switch (VS) I got a little fancy with it. I basically added the logic from the SmartApp into the device handler itself. This way you can use the VS with either my custom app or any app that does a follow me type of logic. You can go into the settings of the VS that’s using this device handler and set options for “On Delay” and “Auto Reset”. So, now this VS just needs something to trigger it and it will wait for a delay to change the contact state to “open” and then optionally automatically close it back. The only tiles I have show the current state and a “close” tile to manually close it. I chose not to allow open so you can’t accidentally trigger your SHM Alarm. But, if you choose so, you can not have it automatically reset, so now you can close it back after it opens. I like this little guy because I added a third state called “timing”. When the VS is triggered and it has the built in delay set, it will change it’s state to timing to let you know it’s working. It will then change to the open state once the timer has expired.
Option 3 - Is simply to use my little app without the delays and just use the fancy device handler
So, what do you think about the Device Handler I created? Is that stretching beyond the tasks a device handler should perform? Should I forget adding that much functionality to a device handler and keep it in the App?