Fixing a bug in locks: latestValue should have similar value with currentValue.
authorrtrimana <rtrimana@uci.edu>
Wed, 31 Jul 2019 21:27:32 +0000 (14:27 -0700)
committerrtrimana <rtrimana@uci.edu>
Wed, 31 Jul 2019 21:27:32 +0000 (14:27 -0700)
Lock/Lock.groovy
Lock/Locks.groovy
ModelCheck.py

index 76482b4..285fe53 100644 (file)
@@ -28,7 +28,8 @@ public class Lock {
        def lock() {
                if (lockState != "locked") {
                        println("the door with id:$id is locked!")
-                       this.lockLatestValue = this.lockState
+                       //this.lockLatestValue = this.lockState
+                       this.lockLatestValue = "locked"
                        this.lockState = "locked"
                        this.currentLock = "locked"
                        sendEvent([name: "lock", value: "locked", deviceId: this.id, descriptionText: "",
@@ -40,7 +41,8 @@ public class Lock {
                if (lockState != "locked") {
                        def task = timers.runAfter(metaData["delay"]) {
                                println("the door with id:$id is locked!")
-                               this.lockLatestValue = this.lockState
+                               //this.lockLatestValue = this.lockState
+                               this.lockLatestValue = "locked"
                                this.lockState = "locked"
                                this.currentLock = "locked"
                                sendEvent([name: "lock", value: "locked", deviceId: this.id, descriptionText: "",
@@ -52,7 +54,8 @@ public class Lock {
        def unlock() {
                if (lockState != "unlocked") {
                        println("the door with id:$id is unlocked!")
-                       this.lockLatestValue = this.lockState
+                       //this.lockLatestValue = this.lockState
+                       this.lockLatestValue = "unlocked"
                        this.lockState = "unlocked"
                        this.currentLock = "unlocked"
                        sendEvent([name: "unlock", value: "unlocked", deviceId: this.id, descriptionText: "",
@@ -64,7 +67,8 @@ public class Lock {
                if (lockState != "unlocked") {
                        def task = timers.runAfter(metaData["delay"]) {
                                println("the door with id:$id is locked!")
-                               this.lockLatestValue = this.lockState
+                               //this.lockLatestValue = this.lockState
+                               this.lockLatestValue = "locked"
                                this.lockState = "locked"
                                this.currentLock = "locked"
                                sendEvent([name: "unlock", value: "unlocked", deviceId: this.id, descriptionText: "",
index 951020f..63d93b4 100644 (file)
@@ -39,7 +39,8 @@ public class Locks{
        //By Apps
        def lock() {
                if (lockState != "locked") {
-                       lockLatestValue = lockState
+                       //lockLatestValue = lockState
+                       lockLatestValue = "locked"
                        lockState = "locked"
                        currentLock = "locked"
                        locks[0].lock()
@@ -49,7 +50,8 @@ public class Locks{
        def lock(LinkedHashMap metaData) {
                if (lockState != "locked") {
                        def task = timers.runAfter(metaData["delay"]) {
-                               lockLatestValue = lockState
+                               //lockLatestValue = lockState
+                               lockLatestValue = "locked"
                                lockState = "locked"
                                currentLock = "locked"
                                locks[0].lock()
@@ -59,7 +61,8 @@ public class Locks{
 
        def unlock() {
                if (lockState != "unlocked") {
-                       lockLatestValue = lockState
+                       //lockLatestValue = lockState
+                       lockLatestValue = "unlocked"
                        lockState = "unlocked"
                        currentLock = "unlocked"
                        locks[0].unlock()
@@ -70,7 +73,8 @@ public class Locks{
        def unlock(LinkedHashMap metaData) {
                if (lockState != "unlocked") {
                        def task = timers.runAfter(metaData["delay"]) {
-                               lockLatestValue = lockState
+                               //lockLatestValue = lockState
+                               lockLatestValue = "unlocked"
                                lockState = "unlocked"
                                currentLock = "unlocked"
                                locks[0].unlock()
index 8ff62ff..1a0c940 100644 (file)
@@ -58,7 +58,6 @@ firstList = sys.argv[4]
 
 # PART 1: Generate the permutations of app pairs
 print "PHASE 1: Extracting the app pairs from the app lists ...\n"
-print "Got here!"
 appList1 = []
 appList2 = []
 # Extract the first list