Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
[smartthings-infrastructure.git] / RelaySwitch / RelaySwitches.groovy
index 4a3df4ff4fa4d010cc0bfa9dc4aba915c1b4a313..fb5977b69dbb704303182e410ccc3e1456c5689e 100644 (file)
@@ -16,12 +16,21 @@ public class RelaySwitches {
        private String currentSwitch = "off"
        private String switchLatestValue = "off"
 
-       RelaySwitches(Closure sendEvent, int deviceNumbers) {
+       RelaySwitches(Closure sendEvent, int deviceNumbers, boolean init) {
                this.sendEvent = sendEvent
                this.timers = new SimulatedTimer()
                this.deviceNumbers = deviceNumbers
                this.relaySwitches = []
 
+               if (init) {
+                       this.switchState = "off"
+                       this.currentSwitch = "off"
+                       this.switchLatestValue = "off"
+               } else {
+                       this.switchState = "on"
+                       this.currentSwitch = "on"
+                       this.switchLatestValue = "on"
+               }
                relaySwitches.add(new RelaySwitch(sendEvent, id, label, displayName, this.switchState, this.currentSwitch, this.switchLatestValue))
        }