-import Timer.SimulatedTimer
-
-public class RelaySwitch {
- private String id
- private String label
- private String displayName
- private String switchState
- private String currentSwitch
- private String switchLatestValue
- def sendEvent
- def timers
-
-
- RelaySwitch(Closure sendEvent, String id, String label, String displayName, String switchState, String currentSwitch, String switchLatestValue) {
- this.sendEvent = sendEvent
- this.timers = new SimulatedTimer()
- this.currentSwitch = currentSwitch
+import SmartThing.SmartThing
+
+public class RelaySwitch extends SmartThing {
+ // id, label, and display name of the device
+ StringBuilder id = new StringBuilder()
+ StringBuilder label = new StringBuilder()
+ StringBuilder displayName = new StringBuilder()
+ // Features with string values
+ StringBuilder currentSwitch = new StringBuilder()
+ // Maps from features to values
+ HashMap<String, StringBuilder> deviceValuesMap = new HashMap<String, StringBuilder>()
+
+ RelaySwitch(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentSwitch) {
+ deviceValuesMap = deviceValueSmartThing
+ idSmartThing = id
+ labelSmartThing = label
+ displayNameSmartThing = displayName
+ sendEventSmartThings = sendEvent
+
+ // Initialization