1 //Create a class for location variable
5 private int contactBookEnabled
10 private String locationMode
13 private List phoneNumbers
14 private String temperatureScale
17 private Phrase helloHome
19 LocationVar(Closure sendEvent, boolean init) {
22 this.hubs = [[id:0, localIP:"128.195.204.105"]]
23 this.modes = [[name: "home"],[name: "away"],[name: "night"]]
25 this.locationMode = "away"
26 this.helloHome = new Phrase()
27 this.contactBookEnabled = 1
28 this.contacts = ['AJ']
29 this.phoneNumbers = [9495379373]
30 this.sendEvent = sendEvent
31 this.timeZone = TimeZone.getTimeZone("America/New_York")
33 this.temperatureScale = "F"
35 this.hubs = [[id:0, localIP:"128.195.204.105"]]
36 this.modes = [[name: "home"],[name: "away"],[name: "night"]]
38 this.locationMode = "home"
39 this.helloHome = new Phrase()
40 this.contactBookEnabled = 1
41 this.contacts = ['AJ']
42 this.phoneNumbers = [9495379373]
43 this.sendEvent = sendEvent
44 this.timeZone = TimeZone.getTimeZone("America/New_York")
46 this.temperatureScale = "F"
52 def setValue(LinkedHashMap eventDataMap) {
53 if (this.mode != eventDataMap['value']) {
54 def sentMode = eventDataMap['value']
55 println("The location is changed to $sentMode!")
57 this.locationMode = sentMode
58 sendEvent(eventDataMap)
62 def currentValue(String deviceFeature) {
63 if (deviceFeature == "sunsetTime" || deviceFeature == "sunset")
64 return System.currentTimeMillis()