Infrastructure compatible with all groups now!
[smartthings-infrastructure.git] / Location / LocationVar.groovy
index cfaa308bb2e74aadeb707e1dbf06261d4648ae98..3f28a0bfbe2100dc105cb8968a0fb2238211af80 100644 (file)
@@ -3,19 +3,42 @@ package Location
 
 class LocationVar {
        private int contactBookEnabled
-       private String modes
+       private def modes
+       private def timeZone
+       private def hubs
        private String mode
+       private String name
        private List contacts
        private List phoneNumbers
-    
+       private String temperatureScale 
+       def sendEvent
+       
        private Phrase helloHome
 
-       LocationVar() {
-               this.modes = "'home', 'away', 'night'"
+       LocationVar(Closure sendEvent) {
+               this.hubs = [[id:0, localIP:"128.195.204.105"]]
+               this.modes = [[name: "home"],[name: "away"],[name: "night"]]
                this.mode = "home"
                this.helloHome = new Phrase()
                this.contactBookEnabled = 1
                this.contacts = ['AJ']
                this.phoneNumbers = [9495379373]
+               this.sendEvent = sendEvent
+               this.timeZone = TimeZone.getTimeZone("America/New_York")
+               this.name = "hub0"
+               this.temperatureScale = "F"
        }
+
+       //By Model Checker
+       def setValue(LinkedHashMap eventDataMap) {
+               def sentMode = eventDataMap['value']
+               println("The location is changed to $sentMode!")
+               this.mode = sentMode
+               sendEvent(eventDataMap)
+       }
+
+       def currentValue(String deviceFeature) {
+               if (deviceFeature == "sunsetTime" || deviceFeature == "sunset")
+                       return System.currentTimeMillis()
+       }
 }