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 76482b4f3262191209360437f60a9343cc8e0337..285fe53217dadf8514de4f32ecb8f60bd5a6afc6 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 951020f106508ab90eb94454258cfd3382c60ef4..63d93b41131aced268ce3d6e4fcb6247428d2b5d 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 8ff62ffb4999da90b85c1b74b1770cdfdce4cfe0..1a0c940bb66ff273d3fc6300b4914d8879f940c5 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