Fixing a bug in Locks group: we have to change the state of the device before sending...
authorrtrimana <rtrimana@uci.edu>
Wed, 31 Jul 2019 19:29:31 +0000 (12:29 -0700)
committerrtrimana <rtrimana@uci.edu>
Wed, 31 Jul 2019 19:29:31 +0000 (12:29 -0700)
Extractor/ExtractorScript.py
Lock/Locks.groovy

index f89c9ea..fc06799 100644 (file)
@@ -227,10 +227,7 @@ def ExtractEvents(extractedEvents):
                        extractedEvents.write("\t\t\t}\n")
                elif eventList[i] == "presence":
                        #Check which capability
-                       print eventVarMap
-                       print capabilityMap
                        variable = eventVarMap[eventList[i]]
-                       print "DEBUG: %s" % variable
                        capability = capabilityMap[variable]
                        #Write three events subsequently
                        extractedEvents.write("\t\t\tdef event = Verify.getInt(0,2)\n")
index 8ebf46b..951020f 100644 (file)
@@ -25,44 +25,44 @@ public class Locks{
                this.deviceNumbers = deviceNumbers
                this.locks = []
 
-               /*def init = Verify.getBoolean()
+               def init = Verify.getBoolean()
                if (init) {
                        this.lockState = "locked"
                        this.lockLatestValue = "locked"
                } else {
                        this.lockState = "unlocked"
                        this.lockLatestValue = "unlocked"
-               }*/
+               }
                locks.add(new Lock(sendEvent,id, label, displayName, this.lockState, this.lockLatestValue))
        }
 
        //By Apps
        def lock() {
                if (lockState != "locked") {
-                       locks[0].lock()
                        lockLatestValue = lockState
                        lockState = "locked"
                        currentLock = "locked"
+                       locks[0].lock()
                }
        }
 
        def lock(LinkedHashMap metaData) {
                if (lockState != "locked") {
                        def task = timers.runAfter(metaData["delay"]) {
-                               locks[0].lock()
                                lockLatestValue = lockState
                                lockState = "locked"
                                currentLock = "locked"
+                               locks[0].lock()
                        }
                }
        }
 
        def unlock() {
                if (lockState != "unlocked") {
-                       locks[0].unlock()
                        lockLatestValue = lockState
                        lockState = "unlocked"
                        currentLock = "unlocked"
+                       locks[0].unlock()
                }
        }
 
@@ -70,10 +70,10 @@ public class Locks{
        def unlock(LinkedHashMap metaData) {
                if (lockState != "unlocked") {
                        def task = timers.runAfter(metaData["delay"]) {
-                               locks[0].unlock()
                                lockLatestValue = lockState
                                lockState = "unlocked"
                                currentLock = "unlocked"
+                               locks[0].unlock()
                        }
                }
        }