Changes in classes: new concept for latest value + all types of events generated...
[smartthings-infrastructure.git] / CarbonMonoxideDetector / CarbonMonoxideDetectors.groovy
index 2eb9d745bb74b47379d8dc3fc5016d2607991320..34495521cd156907f92ef1374f5276be29085ecc 100644 (file)
@@ -41,10 +41,10 @@ public class CarbonMonoxideDetectors {
        //By Model Checker
        def setValue(LinkedHashMap eventDataMap) {
                if (eventDataMap["value"] != carbonMonoxideDetectors[0].currentCarbonMonoxideValue) {
+                       this.carbonMonoxideLatestValue = eventDataMap["value"]
+                       this.carbonMonoxide = eventDataMap["value"]
+                       this.currentCarbonMonoxideValue = eventDataMap["value"]
                        carbonMonoxideDetectors[0].setValue(eventDataMap["value"])
-                       this.carbonMonoxideLatestValue = carbonMonoxideDetectors[0].carbonMonoxideLatestValue
-                       this.carbonMonoxide = carbonMonoxideDetectors[0].currentCarbonMonoxideValue
-                       this.currentCarbonMonoxideValue = carbonMonoxideDetectors[0].currentCarbonMonoxideValue
                        sendEvent(eventDataMap)
                }
        }
@@ -62,6 +62,9 @@ public class CarbonMonoxideDetectors {
        def find(Closure Input) {
                carbonMonoxideDetectors.find(Input)
        }
+       def sort(Closure Input) {
+               carbonMonoxideDetectors.sort(Input)
+       }
        def collect(Closure Input) {
                carbonMonoxideDetectors.collect(Input)
        }