Skip to content

Commit 5edff0d

Browse files
Tim SlagleTim Slagle
Tim Slagle
authored and
Tim Slagle
committed
MSA-588: Update to HHFD
1 parent 29f315a commit 5edff0d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

smartapps/tslagle13/hello-home-phrase-director.src/hello-home-phrase-director.groovy

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* Magic Home
33
*
44
* Copyright 2014 Tim Slagle
@@ -85,6 +85,7 @@
8585
}
8686

8787
def initialize() {
88+
state.clear()
8889
subscribe(people, "presence", presence)
8990
runIn(60, checkSun)
9091
subscribe(location, "sunrise", setSunrise)
@@ -198,7 +199,7 @@
198199

199200
//set home mode when house is occupied
200201
def setHome() {
201-
202+
sendOutOfDateNotification()
202203
log.info("Setting Home Mode!!")
203204
if(anyoneIsHome()) {
204205
if(state.sunMode == "sunset"){
@@ -319,3 +320,14 @@
319320
private hideOptionsSection() {
320321
(starting || ending || days || modes) ? false : true
321322
}
323+
324+
def sendOutOfDateNotification(evt){
325+
if(!state.lastTime){
326+
state.lastTime = (new Date() + 31).getTime()
327+
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.")
328+
}
329+
else if (((new Date()).getTime()) >= state.lastTime){
330+
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.")
331+
state.lastTime = (new Date() + 31).getTime()
332+
}
333+
}

0 commit comments

Comments
 (0)