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