Yes, I did and it works great. here is the code,
/**
*/
definition(
name: “Auto change to Vacation Mode”,
namespace: “”,
author: “Ashutosh Jaiswal”,
description: “This app automatically changes mode from Away to Vacation Mode after it stays in Away mode for a period of time”,
category: “Safety & Security”,
iconUrl: “http://www.clker.com/cliparts/a/5/5/5/1315944954399165199Baggage%20Check.svg.hi.png”,
iconX2Url: “http://www.clker.com/cliparts/a/5/5/5/1315944954399165199Baggage%20Check.svg.hi.png”,
iconX3Url: “http://www.clker.com/cliparts/a/5/5/5/1315944954399165199Baggage%20Check.svg.hi.png”)
preferences {
section(“Choose Mode for Away…”) {
input “AwayMode”,“mode”, title: “Away Mode”
}
section(“Choose Mode for Vacation…”) {
input “VacationMode”,“mode”, title: “Vacation Mode”
}
section(“Change mode to Vacation mode after how much time in Away Mode?”){
input “Time”, “number”, title: “Hours?”
}
}
def installed() {
log.debug “Installed with settings: ${settings}”
initialize()
}
def updated() {
log.debug “Updated with settings: ${settings}”
unsubscribe()
initialize()
}
def initialize() {
subscribe(location, modeChangeHandler)
}
def modeChangeHandler(evt) {
log.debug “Mode change to: ${evt.value}”
if (AwayMode == evt.value) {
def delay = Time*60*60
runIn(delay, changemode)
}
else {
log.debug("Mode did not change to - Away mode")
}
}
def changemode(){
if (AwayMode == location.mode) {
sendPush “Mode has changed to ‘${VacationMode}’ since you were in Away mode for more than ‘${Time}’ hours”
setLocationMode(VacationMode)
}
else {
log.debug “Cannot change to Vacation mode since mode was changed in between”
}
}