//Create a class for location variable
package Location
+import SmartThing.SmartThing
-class LocationVar {
- private int contactBookEnabled
- private def modes
- private String mode
- private List contacts
- private List phoneNumbers
-
- private Phrase helloHome
+public class LocationVar extends SmartThing {
+ // id, label, and display name of the device
+ String id
+ String label
+ String displayName
+ // Maps from features to values
+ HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
+ HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
+ // Other variables
+ Phrase helloHome
+ TimeZone timeZone
+ def modes
+ def hubs
+ List contacts
+ List phoneNumbers
+
+ LocationVar(Closure sendEvent, boolean init) {
+ deviceValueSmartThing = deviceValuesMap
+ deviceIntValueSmartThing = deviceIntValuesMap
+ idSmartThing = id
+ labelSmartThing = label
+ displayNameSmartThing = displayName
+ sendEventSmartThings = sendEvent
- LocationVar() {
- this.modes = [[name: "home"],[name: "away"],[name: "night"]]
- this.mode = "home"
- this.helloHome = new Phrase()
- this.contactBookEnabled = 1
- this.contacts = ['AJ']
- this.phoneNumbers = [9495379373]
+ // Initialization
+ String mode
+ helloHome = new Phrase()
+ contacts = ['AJ']
+ phoneNumbers = [9495379373]
+ modes = [[name: "home"],[name: "away"],[name: "night"]]
+ timeZone = TimeZone.getTimeZone("America/New_York")
+ hubs = [[id:0, localIP:"128.195.204.105"]]
+
+ if (init)
+ mode = "away"
+ else
+ mode = "home"
+
+ deviceValuesMap.put("mode", mode)
+ deviceValuesMap.put("name", "hub0")
+ deviceValuesMap.put("temperatureScale", "F")
+ deviceValuesMap.put("sunset", "sunset")
+ deviceValuesMap.put("sunrise", "sunrise")
+ deviceValuesMap.put("sunsetTime", "sunsetTime")
+ deviceValuesMap.put("sunriseTime", "sunriseTime")
+ deviceIntValuesMap.put("contactBookEnabled", 1)
}
}