displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+
+ def setHue(double hue) {
+ if (hue != this.hue) {
+ this.hue = hue
+ this.currentHue = hue
+ println("The hue level of the light is changed to $hue!")
+ sendEvent([name: "hue", value: "$hue", deviceId: this.id, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+ }
+ }
def setSaturation(int saturation) {
if (saturation != this.saturation) {
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+
+ def setSaturation(double saturation) {
+ if (saturation != this.saturation) {
+ this.currentSaturation = saturation
+ this.saturation = saturation
+ println("The saturation level of the light is changed to $saturation!")
+ sendEvent([name: "saturation", value: "$saturation", deviceId: this.id, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+ }
+ }
+
def setLevel(int level) {
if (level != this.level) {
this.currentSaturation = 40
this.colorTemperature = 10000
this.color = "Red"
- this.currentSwitch = "off"
+ this.currentSwitch = "on"
} else {
this.level = 50
this.currentLevel = 50
this.currentSaturation = 50
this.colorTemperature = 15000
this.color = "Blue"
- this.currentSwitch = "on"
+ this.currentSwitch = "off"
}
colorControls.add(new ColorControl(sendEvent, id, label, displayName, this.color, this.hue, this.saturation, this.level, this.currentSwitch, this.colorTemperature))
}
colorControls[0].setHue(hue)
}
}
+
+ def setHue(double hue) {
+ if (hue != this.hue) {
+ this.hue = hue
+ this.currentHue = hue
+ colorControls[0].setHue((int) hue)
+ }
+ }
def setSaturation(int saturation) {
if (saturation != this.saturation) {
colorControls[0].setSaturation(saturation)
}
}
+
+ def setSaturation(double saturation) {
+ if (saturation != this.saturation) {
+ this.currentSaturation = saturation
+ this.saturation = saturation
+ colorControls[0].setSaturation(saturation)
+ }
+ }
def setLevel(int level) {
if (level != this.level) {
this.jsonData = new groovy.json.JsonSlurper().parseText(data)
this.displayed = displayed
if (integerValues.contains(name)) {
+ int dot = value.indexOf('.')
+ if (dot != -1)
+ value = value.substring(0, dot)
this.integerValue = value.toInteger()
this.doubleValue = Double.parseDouble(value);
}
extractedEvents.write(line)
event.close()
elif eventList[i] == "motion":
+ print("HERE????")
#Write two events subsequently
event = open("eventSimulator/motionActiveEvent.groovy", "r")
for line in event:
def each(Closure Input) {
switches.each(Input)
}
+ def eachWithIndex(Closure Input) {
+ switches.eachWithIndex(Input)
+ }
def find(Closure Input) {
switches.find(Input)
}
buttonObject.setValue([name: "button", value: "held", deviceId: "switchID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"buttonNumber": 3}'])
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"buttonNumber": 1}'])
- buttonObject.setValue([name: "button", value: "pushed", deviceId: "switchID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"buttonNumber": 3}'])
+ buttonObject.setValue([name: "button", value: "pushed", deviceId: "switchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"buttonNumber": 1}'])