Adding sunset and sunrise events.
[smartthings-infrastructure.git] / Methods / subscribe.groovy
1 /////////////////////////////////////////////////////////////////////
2 ////subscribe(obj, func)
3 def subscribe(Object obj, Closure FunctionToCall) {
4         if (obj == app) {
5                 objectList.add(obj)
6                 eventList.add("Touched")
7                 functionList.add(FunctionToCall)
8         } else if (obj == location) {
9                 objectList.add(obj)
10                 eventList.add("Location")
11                 functionList.add(FunctionToCall)
12         }
13 }
14 ////subscribe(obj, event, func)
15 def subscribe(Object obj, String event, Closure FunctionToCall) {
16         objectList.add(obj)
17         eventList.add(event)
18         functionList.add(FunctionToCall)
19 }
20 ////subscribe(obj, event, nameOfFunc)
21 def subscribe(Object obj, String event, String nameOfFunction) {
22         objectList.add(obj)
23         eventList.add(event)
24         functionList.add(nameOfFunction)
25 }
26 ////subscribe(obj, event, func, data)
27 def subscribe(Object obj, String event, Closure FunctionToCall, LinkedHashMap metaData) {
28         objectList.add(obj)     
29         eventList.add(event)
30         functionList.add(FunctionToCall)
31 }