Commit #9: extension to the infrastructure with more devices + minor changes in extra...
[smartthings-infrastructure.git] / Switch / Switch.groovy
index 1e6cf9d7a995d54ee2b3f08792a952f3f20f3038..b9c0a819df5620f31bbf40e18075e5db1d809c15 100644 (file)
@@ -3,7 +3,7 @@ package Switch
 import Timer.SimulatedTimer
 
 public class Switch {
-       private int id
+       private String id
        private String label
        private String displayName
        private String switchState
@@ -14,7 +14,7 @@ public class Switch {
        def timers
        
 
-       Switch(Closure sendEvent, int id, String label, String displayName, String switchState, String currentSwitch, int currentLevel, String switchLatestValue) {
+       Switch(Closure sendEvent, String id, String label, String displayName, String switchState, String currentSwitch, int currentLevel, String switchLatestValue) {
                this.sendEvent = sendEvent
                this.timers = new SimulatedTimer()
                this.currentSwitch = currentSwitch
@@ -38,7 +38,7 @@ public class Switch {
                this.switchState = "on"
                this.currentSwitch = "on"
                sendEvent([name: "switch", value: "on", deviceId: this.id, descriptionText: "",
-                   displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+                   displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "on"]])
        }
 
        def on(LinkedHashMap metaData) {
@@ -48,7 +48,7 @@ public class Switch {
                        this.switchState = "on"
                        this.currentSwitch = "on"
                        sendEvent([name: "switch", value: "on", deviceId: this.id, descriptionText: "",
-                           displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+                           displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "on"]])
                }
        }
 
@@ -58,7 +58,7 @@ public class Switch {
                this.switchState = "off"
                this.currentSwitch = "off"
                sendEvent([name: "switch", value: "off", deviceId: this.id, descriptionText: "",
-                   displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+                   displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "off"]])
        }
 
        def off(LinkedHashMap metaData) {
@@ -68,7 +68,7 @@ public class Switch {
                        this.switchState = "off"
                        this.currentSwitch = "off"
                        sendEvent([name: "switch", value: "off", deviceId: this.id, descriptionText: "",
-                           displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+                           displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "off"]])
                }
        }