- this.color = color
- this.currentColor = color
- this.hue = hue
- this.currentHue = hue
- this.saturation = saturation
- this.currentSaturation = saturation
- this.level = level
- this.currentLevel = level
- this.currentSwitch = currentSwitch
- this.colorTemperature = colorTemperature
- this.sendEvent = sendEvent
- }
-
- //By model checker
- def setValue(String value, String name) {
- if ((name == "color") && (value != this.color)) {
- this.color = value
- this.currentColor = value
- println("the color of the light is changed to $value!")
- } else if ((name == "hue") && (value != this.hue)) {
- this.hue = value.toInteger()
- this.currentHue = value.toInteger()
- println("The hue level of the light is changed to $value!")
- } else if ((name == "saturation") && (value != this.saturation)) {
- this.saturation = value.toInteger()
- this.currentSaturation = value.toInteger()
- println("The saturation level of the light is changed to $value!")
- } else if ((name == "level") && (value != this.level)) {
- this.currentLevel = value.toInteger()
- this.level = value.toInteger()
- println("The level of the light is changed to $value!")
- } else if ((name == "currentSwitch") && (value != this.currentSwitch)) {
- this.currentSwitch = value
- println("The light is changed to $value!")
- } else if ((name == "colorTemperature") && (value != this.colorTemperature)) {
- this.colorTemperature = value.toInteger()
- println("The color temperature level of the light is changed to $value!")
- }
+ this.currentHue = currentHue
+ this.currentSaturation = currentSaturation
+ this.currentColor = currentColor
+
+ deviceValuesMap.put("color", currentColor)
+ deviceIntValuesMap.put("hue", currentHue)
+ deviceIntValuesMap.put("saturation", currentSaturation)