//By Model Checker
def setValue(LinkedHashMap eventDataMap) {
- if (eventDataMap["value"] != thermostats[0].thermostatMode) {
- thermostats[0].setValue(eventDataMap["value"])
- this.thermostatMode = thermostats[0].thermostatMode
- this.currentThermostatMode = thermostats[0].currentThermostatMode
- sendEvent(eventDataMap)
+ if (eventDataMap["name"] == "temperature") {
+ if (eventDataMap["value"] != thermostats[0].temperature) {
+ thermostats[0].setValue(eventDataMap["value"], "temperature")
+ this.temperature = thermostats[0].temperature
+ sendEvent(eventDataMap)
+ }
+ } else if (eventDataMap["name"] == "heatingSetpoint") {
+ if (eventDataMap["value"] != thermostats[0].heatingSetpoint) {
+ thermostats[0].setValue(eventDataMap["value"], "heatingSetpoint")
+ this.heatingSetpoint = thermostats[0].heatingSetpoint
+ sendEvent(eventDataMap)
+ }
+ } else if (eventDataMap["name"] == "coolingSetpoint") {
+ if (eventDataMap["value"] != thermostats[0].coolingSetpoint) {
+ thermostats[0].setValue(eventDataMap["value"], "coolingSetpoint")
+ this.coolingSetpoint = thermostats[0].coolingSetpoint
+ sendEvent(eventDataMap)
+ }
+ } else if (eventDataMap["name"] == "thermostatSetpoint") {
+ if (eventDataMap["value"] != thermostats[0].thermostatSetpoint) {
+ thermostats[0].setValue(eventDataMap["value"], "thermostatSetpoint")
+ this.thermostatSetpoint = thermostats[0].thermostatSetpoint
+ sendEvent(eventDataMap)
+ }
+ } else if (eventDataMap["name"] == "thermostatMode") {
+ if (eventDataMap["value"] != thermostats[0].thermostatMode) {
+ thermostats[0].setValue(eventDataMap["value"], "thermostatMode")
+ this.thermostatMode = thermostats[0].thermostatMode
+ this.currentThermostatMode = thermostats[0].currentThermostatMode
+ sendEvent(eventDataMap)
+ }
+ } else if (eventDataMap["name"] == "thermostatFanMode") {
+ if (eventDataMap["value"] != thermostats[0].thermostatFanMode) {
+ thermostats[0].setValue(eventDataMap["value"], "thermostatFanMode")
+ this.thermostatFanMode = thermostats[0].thermostatFanMode
+ sendEvent(eventDataMap)
+ }
+ } else if (eventDataMap["name"] == "thermostatOperatingState") {
+ if (eventDataMap["value"] != thermostats[0].thermostatOperatingState) {
+ thermostats[0].setValue(eventDataMap["value"], "thermostatOperatingState")
+ this.thermostatOperatingState = thermostats[0].thermostatOperatingState
+ sendEvent(eventDataMap)
+ }
}
}