- 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 == "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!")
- }
- }
-
- //methods
- def setLevel(int level) {
- if (level != this.level) {
- this.currentLevel = level
- this.level = level
- println("The level of the light is changed to $level!")
- sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- }
- }
-
- def setLevel(long level) {
- if (level != this.level) {
- this.currentLevel = level
- this.level = level
- println("The level of the light is changed to $level!")
- sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- }
- }