New commands for hue and non hue groups.
[smartthings-infrastructure.git] / Location / LocationVar.groovy
1 //Create a class for location variable
2 package Location
3
4 class LocationVar {
5         private int contactBookEnabled
6         private def modes
7         private def timeZone
8         private String mode
9         private String name
10         private List contacts
11         private List phoneNumbers
12         def sendEvent
13     
14         private Phrase helloHome
15
16         LocationVar(Closure sendEvent) {
17                 this.modes = [[name: "home"],[name: "away"],[name: "night"]]
18                 this.mode = "home"
19                 this.helloHome = new Phrase()
20                 this.contactBookEnabled = 1
21                 this.contacts = ['AJ']
22                 this.phoneNumbers = [9495379373]
23                 this.sendEvent = sendEvent
24                 this.timeZone = TimeZone.getTimeZone("America/New_York")
25                 this.name = "hub0"
26         }
27
28         //By Model Checker
29         def setValue(LinkedHashMap eventDataMap) {
30                 def sentMode = eventDataMap['value']
31                 println("The location is changed to $sentMode!")
32                 this.mode = sentMode
33                 sendEvent(eventDataMap)
34         }
35 }