X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Thermostat%2FThermostat.groovy;h=b758a4ace45fa8671286c0d548a4f66313a53cae;hb=8bb63273cb49791bd77cabe4e6c9bcc0947cdabd;hp=b3f68b41f9319a1d231934393d4214fb46c80e7a;hpb=752df0b3baa7349d6a0f5bdefb7d644a552bea2e;p=smartthings-infrastructure.git 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"}']) } }