Solving conflicts
[smartthings-infrastructure.git] / Momentary / Momentary.groovy
1 //Create a class for momentory switch device
2 package Momentary
3 import Timer.SimulatedTimer
4
5 public class Momentary {
6         private String id
7         private String label
8         private String displayName
9         def sendEvent   
10         
11
12         Momentary(Closure sendEvent, String id, String label, String displayName) {
13                 this.sendEvent = sendEvent
14                 this.id = id
15                 this.label = label
16                 this.displayName = displayName
17         }
18
19         //By Apps
20         def push() {
21                 println("the momentary switch with id:$id is pushed!")
22                 sendEvent([name: "momentary", value: "pushed", deviceId: this.id, descriptionText: "",
23                            displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
24         }
25
26         //By Model Checker
27         def setValue(String value) {
28                 println("the momentary switch with id:$id is pushed!")
29         }
30         
31 }