From: rtrimana Date: Wed, 7 Aug 2019 21:36:54 +0000 (-0700) Subject: Checking device handlers. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartthings-infrastructure.git;a=commitdiff_plain;h=8bb63273cb49791bd77cabe4e6c9bcc0947cdabd Checking device handlers. --- diff --git a/TemperatureMeasurement/TemperatureMeasurements.groovy b/TemperatureMeasurement/TemperatureMeasurements.groovy index 215894f..608d18b 100644 --- a/TemperatureMeasurement/TemperatureMeasurements.groovy +++ b/TemperatureMeasurement/TemperatureMeasurements.groovy @@ -14,8 +14,8 @@ public class TemperatureMeasurements { private String id = "temperatureMeasurementID0" private String label = "temperatureMeasurement0" private String displayName = "temperatureMeasurement0" - private int temperature = 50 - private int currentTemperature = 50 + private int temperature = 40 + private int currentTemperature = 40 TemperatureMeasurements(Closure sendEvent, int deviceNumbers, boolean init) { this.sendEvent = sendEvent @@ -23,8 +23,8 @@ public class TemperatureMeasurements { this.temperatureMeasurements = [] if (init) { - this.temperature = 50 - this.currentTemperature = 50 + this.temperature = 40 + this.currentTemperature = 40 } else { this.temperature = 60 this.currentTemperature = 60 diff --git a/Thermostat/Thermostat.groovy b/Thermostat/Thermostat.groovy index b3f68b4..b758a4a 100644 --- a/Thermostat/Thermostat.groovy +++ b/Thermostat/Thermostat.groovy @@ -129,7 +129,7 @@ public class Thermostat { this.thermostatMode = "cool" this.currentThermostatMode = "cool" println("Mode of the thermostat with id:$id is changed to cool!") - sendEvent([name: "cool", value: "cool", deviceId: this.id, descriptionText: "", + sendEvent([name: "thermostatMode", value: "cool", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) } } @@ -140,7 +140,7 @@ public class Thermostat { this.thermostatMode = "heat" this.currentThermostatMode = "heat" println("Mode of the thermostat with id:$id is changed to heat!") - sendEvent([name: "heat", value: "heat", deviceId: this.id, descriptionText: "", + sendEvent([name: "thermostatMode", value: "heat", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) } } @@ -151,7 +151,18 @@ public class Thermostat { this.thermostatMode = "auto" this.currentThermostatMode = "auto" println("Mode of the thermostat with id:$id is changed to auto!") - sendEvent([name: "auto", value: "auto", deviceId: this.id, descriptionText: "", + sendEvent([name: "thermostatMode", value: "auto", deviceId: this.id, descriptionText: "", + displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) + } + } + + def emergencyHeat() { + if (this.thermostatMode != "emergencyHeat") { + this.thermostatLatestMode = "emergencyHeat" + this.thermostatMode = "emergencyHeat" + this.currentThermostatMode = "emergencyHeat" + println("Mode of the thermostat with id:$id is changed to emergencyHeat!") + sendEvent([name: "thermostatMode", value: "emergencyHeat", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) } } @@ -162,7 +173,7 @@ public class Thermostat { this.thermostatMode = "off" this.currentThermostatMode = "off" println("Mode of the thermostat with id:$id is changed to off!") - sendEvent([name: "off", value: "off", deviceId: this.id, descriptionText: "", + sendEvent([name: "thermostatMode", value: "off", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) } } diff --git a/Thermostat/Thermostats.groovy b/Thermostat/Thermostats.groovy index acbb23e..2d0bc6c 100644 --- a/Thermostat/Thermostats.groovy +++ b/Thermostat/Thermostats.groovy @@ -163,7 +163,7 @@ public class Thermostats{ thermostats[0].heat() } } - + def auto() { if (thermostatMode != "auto") { this.thermostatLatestMode = "auto" @@ -173,6 +173,15 @@ public class Thermostats{ } } + def emergencyHeat() { + if (thermostatMode != "emergencyHeat") { + this.thermostatLatestMode = "emergencyHeat" + this.thermostatMode = "emergencyHeat" + this.currentThermostatMode = "emergencyHeat" + thermostats[0].emergencyHeat() + } + } + def off() { if (thermostatMode != "off") { this.thermostatLatestMode = "off"