Update thermostat-window-check.groovy
authorRahmadi Trimananda <rahmadi.trimananda@uci.edu>
Tue, 6 Aug 2019 18:29:19 +0000 (11:29 -0700)
committerGitHub Enterprise <noreply@github.uci.edu>
Tue, 6 Aug 2019 18:29:19 +0000 (11:29 -0700)
official/thermostat-window-check.groovy

index 7ae443d..19810c3 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" }