colorControls = smartThings
// Initialization
- StringBuilder id = new StringBuilder("colorControlID0")
- StringBuilder label = new StringBuilder("colorControl")
- StringBuilder displayName = new StringBuilder("colorControl0")
- StringBuilder color = new StringBuilder()
- MutableInteger hue = new MutableInteger()
- MutableInteger saturation = new MutableInteger()
+ String id = "colorControlID0"
+ String label = "colorControl"
+ String displayName = "light"
+ String color
+ Integer hue
+ Integer saturation
if (init) {
- color.append("Red")
- hue.setValue(30)
- saturation.setValue(40)
+ color = "Red"
+ hue = 30
+ saturation = 40
} else {
- color.append("Blue")
- hue.setValue(50)
- saturation.setValue(50)
+ color = "Blue"
+ hue = 50
+ saturation = 50
}
colorControls.add(new ColorControl(sendEvent, id, label, displayName, color, hue,
def off() {
colorControls[0].off()
}
-
- // Methods to return values
- def getCurrentHue() {
- List tmpValues = new ArrayList()
- tmpValues.add(colorControls[0].getCurrentHue())
- return tmpValues
- }
-
- def getCurrentSaturation() {
- List tmpValues = new ArrayList()
- tmpValues.add(colorControls[0].getCurrentSaturation())
- return tmpValues
- }
-
- def getCurrentColor() {
- List tmpValues = new ArrayList()
- tmpValues.add(colorControls[0].getCurrentColor())
- return tmpValues
- }
}