1 //Create a class for relay switch device
3 import SmartThing.SmartThing
5 public class RelaySwitch extends SmartThing {
6 // id, label, and display name of the device
10 // Maps from features to values
11 HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
13 RelaySwitch(Closure sendEvent, String id, String label, String displayName, String currentSwitch) {
14 deviceValueSmartThing = deviceValuesMap
16 labelSmartThing = label
17 displayNameSmartThing = displayName
18 sendEventSmartThings = sendEvent
23 this.displayName = displayName
25 deviceValuesMap.put("switch", currentSwitch)
28 // Methods to set values
30 action("on", "switch")
33 def on(LinkedHashMap metaData) {
38 action("off", "switch")
41 def off(LinkedHashMap metaData) {