From 8a56afd7669acbe3e241bdb67a03f8f6a079d76a Mon Sep 17 00:00:00 2001 From: Rahmadi Trimananda Date: Tue, 6 Aug 2019 11:29:19 -0700 Subject: [PATCH] Update thermostat-window-check.groovy --- official/thermostat-window-check.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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" } -- 2.34.1