package SwitchLevel
import SmartThing.SmartThings
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
public class SwitchLevels extends SmartThings {
List switchLevels = new ArrayList()
switchLevels = smartThings
// Initialization
- StringBuilder id = new StringBuilder("switchLevelID0")
- StringBuilder label = new StringBuilder("switchLevel")
- StringBuilder displayName = new StringBuilder("switchLevel0")
- MutableInteger level = new MutableInteger()
+ String id = "switchLevelID0"
+ String label = "level"
+ String displayName = "switchLevel"
+ Integer level
if (init)
- level.setValue(50)
+ level = 50
else
- level.setValue(60)
+ level = 60
switchLevels.add(new SwitchLevel(sendEvent, id, label, displayName, level))
}
def setLevel(int newValue) {
switchLevels[0].setLevel(newValue)
}
-
- // Methods to return values
- def getCurrentLevel() {
- List tmpValues = new ArrayList()
- tmpValues.add(switchLevels[0].getCurrentLevel())
- return tmpValues
- }
}