this.switchState = switchState
this.currentSwitch = switchState
this.switchLatestValue = switchLatestValue
this.switchState = switchState
this.currentSwitch = switchState
this.switchLatestValue = switchLatestValue
def setColor(LinkedHashMap metaData) {
if ((this.level != metaData["level"]) || (this.hue != metaData["hue"]) || (this.saturation != metaData["saturation"])) {
this.level = metaData["level"]
def setColor(LinkedHashMap metaData) {
if ((this.level != metaData["level"]) || (this.hue != metaData["hue"]) || (this.saturation != metaData["saturation"])) {
this.level = metaData["level"]
println("the switch with id:$id is setted to level $level and hue to $hue and saturation to $saturation!")
sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
println("the switch with id:$id is setted to level $level and hue to $hue and saturation to $saturation!")
sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
sendEvent([name: "saturation", value: "$saturation", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
sendEvent([name: "saturation", value: "$saturation", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
def setLevel(int level) {
if (this.level != level) {
println("the switch with id:$id is setted to level $level!")
this.level = level
}
def setLevel(int level) {
if (this.level != level) {
println("the switch with id:$id is setted to level $level!")
this.level = level
sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
} else if (name == "level") {
println("the switch with id:$id is setted to level $value!")
this.level = value.toInteger()
} else if (name == "level") {
println("the switch with id:$id is setted to level $value!")
this.level = value.toInteger()