Update nfc-tag-toggle.groovy
authorRahmadi Trimananda <rahmadi.trimananda@uci.edu>
Fri, 26 Jul 2019 17:57:54 +0000 (10:57 -0700)
committerGitHub Enterprise <noreply@github.uci.edu>
Fri, 26 Jul 2019 17:57:54 +0000 (10:57 -0700)
Code modifications to accommodate our model-checking infrastructure.

official/nfc-tag-toggle.groovy

index 497be41..a637d30 100755 (executable)
@@ -49,13 +49,16 @@ def pageTwo() {
                 "to determine whether to turn on or off the devices.") {
             
             if (switch1 || masterSwitch) {
-                input "masterSwitch", "enum", title: "Master switch", options: switch1.collect{[(it.id): it.displayName]}, required: false
+                //input "masterSwitch", "enum", title: "Master switch", options: switch1.collect{[(it.id): it.displayName]}, required: false
+               input "masterSwitch", "enum", title: "Master switch", options: switch1.collect{[(it.id)]}, required: false
             }
             if (lock || masterLock) {
-                input "masterLock", "enum", title: "Master lock", options: lock.collect{[(it.id): it.displayName]}, required: false
+                //input "masterLock", "enum", title: "Master lock", options: lock.collect{[(it.id): it.displayName]}, required: false
+               input "masterLock", "enum", title: "Master lock", options: lock.collect{[(it.id)]}, required: false
             }
             if (garageDoor || masterDoor) {
-                input "masterDoor", "enum", title: "Master door", options: garageDoor.collect{[(it.id): it.displayName]}, required: false
+                //input "masterDoor", "enum", title: "Master door", options: garageDoor.collect{[(it.id): it.displayName]}, required: false
+               input "masterDoor", "enum", title: "Master door", options: garageDoor.collect{[(it.id)]}, required: false
             }            
                }
                section([mobileOnly:true]) {
@@ -87,7 +90,8 @@ private currentStatus(devices, master, attribute) {
        log.trace "currentStatus($devices, $master, $attribute)"
        def result = null
        if (master) {
-       result = devices.find{it.id == master}?.currentValue(attribute)
+       //result = devices.find{it.id == master}?.currentValue(attribute)
+       result = devices.find{"[" + it.id + "]" == master}?.currentValue(attribute)
     }
     else {
        def map = [:]