Adding new default value to thermostat device.
[smartthings-infrastructure.git] / Thermostat / Thermostats.groovy
index acbb23ee1975d501e3cb613799d24edcac239973..9c660c9badf176dae3da5c03810c6e64082a12d5 100644 (file)
@@ -25,13 +25,13 @@ public class Thermostats{
        private supportedThermostatFanModes = ["auto", "fanCirculate", "circulate", "fanOn", "on"]
        private supportedThermostatModes = ["auto", "cool", "emergencyHeat", "heat", "off"]
        private String thermostatOperatingState = "cooling"
-       private String thermostatFanMode = "auto"
-       private String thermostatMode = "auto"
-       private String currentThermostatMode = "auto"
+       private String thermostatFanMode = "off"
+       private String thermostatMode = "off"
+       private String currentThermostatMode = "off"
        private String climateName = ""
-       private String thermostatLatestMode = "auto"
+       private String thermostatLatestMode = "off"
        private String thermostatLatestOperatingState = "cooling"
-       private String thermostatLatestFanMode = "auto"
+       private String thermostatLatestFanMode = "off"
        private int latestCoolingSetPoint = 70
        private int latestThermostatSetPoint = 60
        private int latestHeatingSetPoint = 50
@@ -51,11 +51,11 @@ public class Thermostats{
                        this.currentHeatingSetpoint = 35
                        this.heatingSetpoint = 35
                        this.thermostatSetpoint = 50
-                       this.thermostatFanMode = "auto"
-                       this.thermostatLatestFanMode = "auto"
-                       this.thermostatMode = "auto"
-                       this.currentThermostatMode = "auto"
-                       this.thermostatLatestMode = "auto"
+                       this.thermostatFanMode = "off"
+                       this.thermostatLatestFanMode = "off"
+                       this.thermostatMode = "off"
+                       this.currentThermostatMode = "off"
+                       this.thermostatLatestMode = "off"
                } else {
                        this.temperature = 66
                        this.currentTemperature = 66
@@ -66,9 +66,9 @@ public class Thermostats{
                        this.thermostatSetpoint = 60
                        this.thermostatFanMode = "circulate"
                        this.thermostatLatestFanMode = "circulate"
-                       this.thermostatMode = "off"
-                       this.currentThermostatMode = "off"
-                       this.thermostatLatestMode = "off"               
+                       this.thermostatMode = "auto"
+                       this.currentThermostatMode = "auto"
+                       this.thermostatLatestMode = "auto"              
                }
                thermostats.add(new Thermostat(sendEvent, id, label, displayName, this.temperature, this.currentCoolingSetpoint, 
                                                this.currentHeatingSetpoint, this.coolingSetpoint, this.thermostatSetpoint, this.heatingSetpoint, this.coolingSetpointRange,
@@ -141,7 +141,7 @@ public class Thermostats{
                if (thermostatMode != this.thermostatMode) {
                        this.thermostatLatestMode = thermostatMode
                        this.thermostatMode = thermostatMode
-                       this.currentThermostatMode = currentThermostatMode
+                       this.currentThermostatMode = thermostatMode
                        thermostats[0].setThermostatMode(thermostatMode)
                }
        }
@@ -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"