Fixing bug in Mobile Presence class
[smartthings-infrastructure.git] / Momentary / Momentary.groovy
1 //Create a class for momentory switch device
2 package Momentary
3 import SmartThing.SmartThing
4
5 public class Momentary extends SmartThing {
6         // id, label, and display name of the device
7         String id
8         String label
9         String displayName
10
11         Momentary(Closure sendEvent, String id, String label, String displayName) {
12                 idSmartThing = id
13                 labelSmartThing = label
14                 displayNameSmartThing = displayName
15                 sendEventSmartThings = sendEvent
16
17                 // Initialization
18                 this.id = id
19                 this.label = label
20                 this.displayName = displayName
21         }
22
23         // Methods to set values
24         def push() {
25                 setValue([name: "momentary", value: "pushed", deviceId: id, descriptionText: "",
26                           displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
27         }       
28 }