From: amiraj Date: Fri, 9 Aug 2019 00:28:52 +0000 (-0700) Subject: Check if only sent mode is different with current mode, send event in Location class! X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartthings-infrastructure.git;a=commitdiff_plain;h=8613a97637269f3566333b3655b419a8489bb947;ds=sidebyside Check if only sent mode is different with current mode, send event in Location class! --- diff --git a/Location/LocationVar.groovy b/Location/LocationVar.groovy index a114c1f..99f3429 100644 --- a/Location/LocationVar.groovy +++ b/Location/LocationVar.groovy @@ -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) {