Solving conflicts
[smartthings-infrastructure.git] / Momentary / Momentary.groovy
diff --git a/Momentary/Momentary.groovy b/Momentary/Momentary.groovy
new file mode 100644 (file)
index 0000000..6b9f0e0
--- /dev/null
@@ -0,0 +1,31 @@
+//Create a class for momentory switch device
+package Momentary
+import Timer.SimulatedTimer
+
+public class Momentary {
+       private String id
+       private String label
+       private String displayName
+       def sendEvent   
+       
+
+       Momentary(Closure sendEvent, String id, String label, String displayName) {
+               this.sendEvent = sendEvent
+               this.id = id
+               this.label = label
+               this.displayName = displayName
+       }
+
+       //By Apps
+       def push() {
+               println("the momentary switch with id:$id is pushed!")
+               sendEvent([name: "momentary", value: "pushed", deviceId: this.id, descriptionText: "",
+                          displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+       }
+
+       //By Model Checker
+       def setValue(String value) {
+               println("the momentary switch with id:$id is pushed!")
+       }
+       
+}