//Create a class for switch level package SwitchLevel import SmartThing.SmartThings public class SwitchLevels extends SmartThings { List switchLevels = new ArrayList() SwitchLevels(Closure sendEvent, boolean init) { // Only initialize one time since we only have one device for each capability switchLevels = smartThings // Initialization String id = "switchLevelID0" String label = "level" String displayName = "switchLevel" Integer level if (init) level = 50 else level = 60 switchLevels.add(new SwitchLevel(sendEvent, id, label, displayName, level)) } // Methods to set values def setLevel(String newValue) { setLevel(newValue.toInteger()) } def setLevel(long newValue) { setLevel((int) newValue) } def setLevel(int newValue) { switchLevels[0].setLevel(newValue) } }