From 8613a97637269f3566333b3655b419a8489bb947 Mon Sep 17 00:00:00 2001 From: amiraj Date: Thu, 8 Aug 2019 17:28:52 -0700 Subject: [PATCH] Check if only sent mode is different with current mode, send event in Location class! --- Location/LocationVar.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) { -- 2.34.1