Check if only sent mode is different with current mode, send event in Location class!
authoramiraj <amiraj.95@uci.edu>
Fri, 9 Aug 2019 00:28:52 +0000 (17:28 -0700)
committeramiraj <amiraj.95@uci.edu>
Fri, 9 Aug 2019 00:28:52 +0000 (17:28 -0700)
Location/LocationVar.groovy

index a114c1f..99f3429 100644 (file)
@@ -47,10 +47,12 @@ class LocationVar {
 
        //By Model Checker
        def setValue(LinkedHashMap eventDataMap) {
-               def sentMode = eventDataMap['value']
-               println("The location is changed to $sentMode!")
-               this.mode = sentMode
-               sendEvent(eventDataMap)
+               if (this.mode != eventDataMap['value']) {
+                       def sentMode = eventDataMap['value']
+                       println("The location is changed to $sentMode!")
+                       this.mode = sentMode
+                       sendEvent(eventDataMap)
+               }
        }
 
        def currentValue(String deviceFeature) {