From: Rahmadi Trimananda <rahmadi.trimananda@uci.edu>
Date: Tue, 6 Aug 2019 18:29:19 +0000 (-0700)
Subject: Update thermostat-window-check.groovy
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8a56afd7669acbe3e241bdb67a03f8f6a079d76a;p=smartapps.git

Update thermostat-window-check.groovy
---

diff --git a/official/thermostat-window-check.groovy b/official/thermostat-window-check.groovy
index 7ae443d..19810c3 100755
--- a/official/thermostat-window-check.groovy
+++ b/official/thermostat-window-check.groovy
@@ -71,9 +71,13 @@ def thermoChange(evt) {
   }
 }
 
+// These should have been global variables
+def heating
+def cooling
+
 def windowChange(evt) {
-  def heating = thermostats.findAll { it?.latestValue("thermostatMode") == "heat" }
-  def cooling = thermostats.findAll { it?.latestValue("thermostatMode") == "cool" }
+  heating = thermostats.findAll { it?.latestValue("thermostatMode") == "heat" }
+  cooling = thermostats.findAll { it?.latestValue("thermostatMode") == "cool" }
 
   if(heating || cooling) {
     def open = sensors.findAll { it?.latestValue("contact") == "open" }