Fixing some bugs
[smartthings-infrastructure.git] / RelativeHumidityMeasurement / RelativeHumidityMeasurement.groovy
index c9ad722..47da3b5 100644 (file)
@@ -16,6 +16,21 @@ public class RelativeHumidityMeasurement {
                this.humidity = humidity
        }
 
+       def eventsSince() {
+               def evtHumidity = [[name: "humidity", value: this.humidity.toString(), deviceId: "humidityMeasurementID0", descriptionText: "",
+                               displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def init = Verify.getInt(0,1)
+               def evtToSend = []
+               if (init == 0) {//return empty set
+                       return evtToSend
+               } else if (init == 1) {//send one open event
+                       evtHumidity.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               }
+       }
+
        //By Model Checker
        def setValue(String value) {
                println("the humidity is changed to $value!")