From 5edff0df53cef71bceebe612f5f3e6cb4e806556 Mon Sep 17 00:00:00 2001 From: Tim Slagle Date: Mon, 28 Sep 2015 18:48:18 -0700 Subject: [PATCH] MSA-588: Update to HHFD --- .../hello-home-phrase-director.groovy | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/smartapps/tslagle13/hello-home-phrase-director.src/hello-home-phrase-director.groovy b/smartapps/tslagle13/hello-home-phrase-director.src/hello-home-phrase-director.groovy index de520ec..50fe8b6 100644 --- a/smartapps/tslagle13/hello-home-phrase-director.src/hello-home-phrase-director.groovy +++ b/smartapps/tslagle13/hello-home-phrase-director.src/hello-home-phrase-director.groovy @@ -1,4 +1,4 @@ - /** +/** * Magic Home * * Copyright 2014 Tim Slagle @@ -85,6 +85,7 @@ } def initialize() { + state.clear() subscribe(people, "presence", presence) runIn(60, checkSun) subscribe(location, "sunrise", setSunrise) @@ -198,7 +199,7 @@ //set home mode when house is occupied def setHome() { - + sendOutOfDateNotification() log.info("Setting Home Mode!!") if(anyoneIsHome()) { if(state.sunMode == "sunset"){ @@ -319,3 +320,14 @@ private hideOptionsSection() { (starting || ending || days || modes) ? false : true } + + def sendOutOfDateNotification(evt){ + if(!state.lastTime){ + state.lastTime = (new Date() + 31).getTime() + sendNotification("Your version of Hello, Home Phrase Director is currently out of date. Please look for the new version of Hello, Home Phrase Director now called 'Routine Director' in the marketplace.") + } + else if (((new Date()).getTime()) >= state.lastTime){ + sendNotification("Your version of Hello, Home Phrase Director is currently out of date. Please look for the new version of Hello, Home Phrase Director now called 'Routine Director' in the marketplace.") + state.lastTime = (new Date() + 31).getTime() + } + } \ No newline at end of file