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 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" }