//Create a class for relay switch device package RelaySwitch import SmartThing.SmartThings public class RelaySwitches extends SmartThings { List relaySwitches = new ArrayList() RelaySwitches(Closure sendEvent, boolean init) { // Only initialize one time since we only have one device for each capability relaySwitches = smartThings // Initialization String id = "relaySwitchID0" String label = "switch" String displayName = "relaySwitch" String currentSwitch if (init) currentSwitch = "off" else currentSwitch = "on" relaySwitches.add(new RelaySwitch(sendEvent, id, label, displayName, currentSwitch)) } // Methods to set values def on() { relaySwitches[0].on() } def on(LinkedHashMap metaData) { on() } def off() { relaySwitches[0].off() } def off(LinkedHashMap metaData) { off() } }