From c428267d63b011cdf4ef379096b21120c87f4c72 Mon Sep 17 00:00:00 2001 From: vlaminck Date: Mon, 26 Sep 2016 14:05:03 -0500 Subject: [PATCH 1/3] Fix: stop sending 100 percent from completion --- smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy b/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy index e5f60b7..3e31622 100644 --- a/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy +++ b/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy @@ -608,8 +608,6 @@ private completion() { handleCompletionMessaging() handleCompletionModesAndPhrases() - - sendTimeRemainingEvent(100) } private handleCompletionSwitches() { From 797a58cb688e9c5da55ee5a5082787034cacf0a5 Mon Sep 17 00:00:00 2001 From: vlaminck Date: Mon, 26 Sep 2016 14:14:55 -0500 Subject: [PATCH 2/3] Fix: hide reset events --- .../gentle-wake-up.src/gentle-wake-up.groovy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy b/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy index 3e31622..9d8b527 100644 --- a/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy +++ b/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy @@ -455,16 +455,19 @@ def sendStopEvent(source) { } sendControllerEvent(eventData) - sendTimeRemainingEvent(0) + // send 100% completion + sendTimeRemainingEvent(100) + // send a non-displayed 0% completion to reset tiles + sendTimeRemainingEvent(0, false) } -def sendTimeRemainingEvent(percentComplete) { +def sendTimeRemainingEvent(percentComplete, displayed = true) { log.trace "sendTimeRemainingEvent(${percentComplete})" def percentCompleteEventData = [ name: "percentComplete", value: percentComplete as int, - displayed: true, + displayed: displayed, isStateChange: true ] sendControllerEvent(percentCompleteEventData) @@ -474,7 +477,7 @@ def sendTimeRemainingEvent(percentComplete) { def timeRemainingEventData = [ name: "timeRemaining", value: displayableTime(timeRemaining), - displayed: true, + displayed: displayed, isStateChange: true ] sendControllerEvent(timeRemainingEventData) From e4c1824afdbcca05386f512859ffe884e38d8912 Mon Sep 17 00:00:00 2001 From: vlaminck Date: Mon, 26 Sep 2016 14:18:31 -0500 Subject: [PATCH 3/3] Fix: reorder events so the feed makes more sense --- .../smartthings/gentle-wake-up.src/gentle-wake-up.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy b/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy index 9d8b527..3fed2e8 100644 --- a/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy +++ b/smartapps/smartthings/gentle-wake-up.src/gentle-wake-up.groovy @@ -454,11 +454,14 @@ def sendStopEvent(source) { eventData.value += "cancelled" } - sendControllerEvent(eventData) - // send 100% completion + // send 100% completion event sendTimeRemainingEvent(100) + // send a non-displayed 0% completion to reset tiles sendTimeRemainingEvent(0, false) + + // send sessionStatus event last so the event feed is ordered properly + sendControllerEvent(eventData) } def sendTimeRemainingEvent(percentComplete, displayed = true) {