1 //Create a class for location variable
5 private int contactBookEnabled
12 private List phoneNumbers
13 private String temperatureScale
16 private Phrase helloHome
18 LocationVar(Closure sendEvent, boolean init) {
21 this.hubs = [[id:0, localIP:"128.195.204.105"]]
22 this.modes = [[name: "home"],[name: "away"],[name: "night"]]
24 this.helloHome = new Phrase()
25 this.contactBookEnabled = 1
26 this.contacts = ['AJ']
27 this.phoneNumbers = [9495379373]
28 this.sendEvent = sendEvent
29 this.timeZone = TimeZone.getTimeZone("America/New_York")
31 this.temperatureScale = "F"
33 this.hubs = [[id:0, localIP:"128.195.204.105"]]
34 this.modes = [[name: "home"],[name: "away"],[name: "night"]]
36 this.helloHome = new Phrase()
37 this.contactBookEnabled = 1
38 this.contacts = ['AJ']
39 this.phoneNumbers = [9495379373]
40 this.sendEvent = sendEvent
41 this.timeZone = TimeZone.getTimeZone("America/New_York")
43 this.temperatureScale = "F"
49 def setValue(LinkedHashMap eventDataMap) {
50 if (this.mode != eventDataMap['value']) {
51 def sentMode = eventDataMap['value']
52 println("The location is changed to $sentMode!")
54 sendEvent(eventDataMap)
58 def currentValue(String deviceFeature) {
59 if (deviceFeature == "sunsetTime" || deviceFeature == "sunset")
60 return System.currentTimeMillis()