From 90384d0852bf6c05b0314224989fce5d7b7f4a2c Mon Sep 17 00:00:00 2001 From: David Sainte-Claire Date: Tue, 16 Aug 2016 11:35:04 -0700 Subject: [PATCH 1/2] DVCSMP-1959 fixed issue with logging personal information and unused subscription from SmartApps --- .../docwisdom/humidity-alert.src/humidity-alert.groovy | 4 ++-- .../dooglave/let-there-be-dark.src/let-there-be-dark.groovy | 6 +----- .../smart-humidifier.src/smart-humidifier.groovy | 6 +++--- smartapps/smartthings/its-too-cold.src/its-too-cold.groovy | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/smartapps/docwisdom/humidity-alert.src/humidity-alert.groovy b/smartapps/docwisdom/humidity-alert.src/humidity-alert.groovy index 26ffeca..d194906 100644 --- a/smartapps/docwisdom/humidity-alert.src/humidity-alert.groovy +++ b/smartapps/docwisdom/humidity-alert.src/humidity-alert.groovy @@ -78,7 +78,7 @@ def humidityHandler(evt) { log.debug "Notification already sent within the last ${deltaMinutes} minutes" } else { - log.debug "Humidity Rose Above ${tooHumid}: sending SMS to $phone1 and activating ${mySwitch}" + log.debug "Humidity Rose Above ${tooHumid}: sending SMS and activating ${mySwitch}" send("${humiditySensor1.label} sensed high humidity level of ${evt.value}") switch1?.on() } @@ -91,7 +91,7 @@ def humidityHandler(evt) { log.debug "Notification already sent within the last ${deltaMinutes} minutes" } else { - log.debug "Humidity Fell Below ${notHumidEnough}: sending SMS to $phone1 and activating ${mySwitch}" + log.debug "Humidity Fell Below ${notHumidEnough}: sending SMS and activating ${mySwitch}" send("${humiditySensor1.label} sensed high humidity level of ${evt.value}") switch1?.off() } diff --git a/smartapps/dooglave/let-there-be-dark.src/let-there-be-dark.groovy b/smartapps/dooglave/let-there-be-dark.src/let-there-be-dark.groovy index 73d5d46..11a986c 100644 --- a/smartapps/dooglave/let-there-be-dark.src/let-there-be-dark.groovy +++ b/smartapps/dooglave/let-there-be-dark.src/let-there-be-dark.groovy @@ -25,14 +25,10 @@ preferences { def installed() { subscribe(contact1, "contact", contactHandler) - subscribe(switch1, "switch.on", switchOnHandler) - subscribe(switch1, "switch.off", switchOffHandler) } def updated() { unsubscribe() - subscribe(contact1, "contact", contactHandler) - subscribe(switch1, "switch.on", switchOnHandler) subscribe(switch1, "switch.off", switchOffHandler) } @@ -46,4 +42,4 @@ def contactHandler(evt) { if (evt.value == "closed") { if(state.wasOn)switch1.on() } -} \ No newline at end of file +} diff --git a/smartapps/sheikhsphere/smart-humidifier.src/smart-humidifier.groovy b/smartapps/sheikhsphere/smart-humidifier.src/smart-humidifier.groovy index c489a22..eaf30ba 100644 --- a/smartapps/sheikhsphere/smart-humidifier.src/smart-humidifier.groovy +++ b/smartapps/sheikhsphere/smart-humidifier.src/smart-humidifier.groovy @@ -77,7 +77,7 @@ def humidityHandler(evt) { } else { if (state.lastStatus != "off") { - log.debug "Humidity Rose Above $humidityHigh1: sending SMS to $phone1 and deactivating $mySwitch" + log.debug "Humidity Rose Above $humidityHigh1: sending SMS and deactivating $mySwitch" send("${humiditySensor1.label} sensed high humidity level of ${evt.value}, turning off ${switch1.label}") switch1?.off() state.lastStatus = "off" @@ -99,7 +99,7 @@ def humidityHandler(evt) { } else { if (state.lastStatus != "on") { - log.debug "Humidity Dropped Below $humidityLow1: sending SMS to $phone1 and activating $mySwitch" + log.debug "Humidity Dropped Below $humidityLow1: sending SMS and activating $mySwitch" send("${humiditySensor1.label} sensed low humidity level of ${evt.value}, turning on ${switch1.label}") switch1?.on() state.lastStatus = "on" @@ -125,4 +125,4 @@ private send(msg) { } log.debug msg -} \ No newline at end of file +} diff --git a/smartapps/smartthings/its-too-cold.src/its-too-cold.groovy b/smartapps/smartthings/its-too-cold.src/its-too-cold.groovy index 8364c20..e06f8a2 100644 --- a/smartapps/smartthings/its-too-cold.src/its-too-cold.groovy +++ b/smartapps/smartthings/its-too-cold.src/its-too-cold.groovy @@ -69,10 +69,10 @@ def temperatureHandler(evt) { def alreadySentSms = recentEvents.count { it.doubleValue <= tooCold } > 1 if (alreadySentSms) { - log.debug "SMS already sent to $phone1 within the last $deltaMinutes minutes" + log.debug "SMS already sent within the last $deltaMinutes minutes" // TODO: Send "Temperature back to normal" SMS, turn switch off } else { - log.debug "Temperature dropped below $tooCold: sending SMS to $phone1 and activating $mySwitch" + log.debug "Temperature dropped below $tooCold: sending SMS and activating $mySwitch" def tempScale = location.temperatureScale ?: "F" send("${temperatureSensor1.displayName} is too cold, reporting a temperature of ${evt.value}${evt.unit?:tempScale}") switch1?.on() From 0d4a00ae2b83fef95ae4d87c2f922f4d2dc2f88e Mon Sep 17 00:00:00 2001 From: David Sainte-Claire Date: Tue, 16 Aug 2016 11:46:47 -0700 Subject: [PATCH 2/2] fixed wrong subscription based on code review comment --- .../dooglave/let-there-be-dark.src/let-there-be-dark.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartapps/dooglave/let-there-be-dark.src/let-there-be-dark.groovy b/smartapps/dooglave/let-there-be-dark.src/let-there-be-dark.groovy index 11a986c..3e9d99d 100644 --- a/smartapps/dooglave/let-there-be-dark.src/let-there-be-dark.groovy +++ b/smartapps/dooglave/let-there-be-dark.src/let-there-be-dark.groovy @@ -29,7 +29,7 @@ def installed() { def updated() { unsubscribe() - subscribe(switch1, "switch.off", switchOffHandler) + subscribe(contact1, "contact", contactHandler) } def contactHandler(evt) {