Changes in classes: new concept for latest value + all types of events generated...
[smartthings-infrastructure.git] / BeaconSensor / BeaconSensors.groovy
index 33dd1fe65d39c1bed0a933ef177a7f36029eaee0..a36a4a487f9c536752ac0d9af9ca2de4459007b7 100644 (file)
@@ -38,10 +38,10 @@ public class BeaconSensors {
        //By Model Checker
        def setValue(LinkedHashMap eventDataMap) {
                if (eventDataMap["value"] != beaconSensors[0].presence) {
+                       this.presenceLatestValue = eventDataMap["value"]
+                       this.presence = eventDataMap["value"]
+                       this.currentPresence = eventDataMap["value"]
                        beaconSensors[0].setValue(eventDataMap["value"])
-                       this.presenceLatestValue = beaconSensors[0].presenceLatestValue
-                       this.presence = beaconSensors[0].presence
-                       this.currentPresence = beaconSensors[0].presence
                        sendEvent(eventDataMap)
                }
        }
@@ -56,6 +56,9 @@ public class BeaconSensors {
        def each(Closure Input) {
                beaconSensors.each(Input)
        }
+       def sort(Closure Input) {
+               beaconSensors.sort(Input)
+       }
        def find(Closure Input) {
                beaconSensors.find(Input)
        }