Update thermostat-window-check.groovy
[smartapps.git] / official / thermostat-window-check.groovy
index 7ae443d9b7cc2c0e0f37c9c3f744b761c54df098..19810c39d801a7c46b5400a404fbb9ad0677c4e2 100755 (executable)
@@ -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" }