1 //Create a class for switch level
3 import SmartThing.SmartThings
5 public class SwitchLevels extends SmartThings {
6 List switchLevels = new ArrayList()
8 SwitchLevels(Closure sendEvent, boolean init) {
9 // Only initialize one time since we only have one device for each capability
10 switchLevels = smartThings
13 String id = "switchLevelID0"
14 String label = "level"
15 String displayName = "switchLevel"
23 switchLevels.add(new SwitchLevel(sendEvent, id, label, displayName, level))
26 // Methods to set values
27 def setLevel(String newValue) {
28 setLevel(newValue.toInteger())
31 def setLevel(long newValue) {
32 setLevel((int) newValue)
35 def setLevel(int newValue) {
36 switchLevels[0].setLevel(newValue)