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 def sentMode = eventDataMap['value']
51 println("The location is changed to $sentMode!")
53 sendEvent(eventDataMap)
56 def currentValue(String deviceFeature) {
57 if (deviceFeature == "sunsetTime" || deviceFeature == "sunset")
58 return System.currentTimeMillis()