SmartThings Community

A little help modifying from template


#1

Hi
Just starting out with SmartThings and playing around with handlers.
I have the BASICS of writing/reading code from some C++ courses in first year, but not much past that.

I’m looking to add the functionality described here (display when the sensor was last opened):

First attempt was to take the template of the Z-Wave Door/Window sensor, and add the code bits that used “lastcheckin”. No dice, but not sure where I’ve gone wrong (I did have to figure out I need to change the “runlocally” to false.


(Alec McLure) #2

If you want, take a look at this DTH for the Xiaomi door sensor - it has functionality for a “lastOpened” and “lastOpenedDate” as a secondary control. Note that it also allows you to reset manually and has a date format.

Note that it has a date format (US vs. UK) in preferences which feeds into the functionality to get current time.