package Location
import SmartThing.SmartThing
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
public class LocationVar extends SmartThing {
- // Features with numberical values
- MutableInteger contactBookEnabled = new MutableInteger()
- // Features with string values
- StringBuilder mode = new StringBuilder()
- StringBuilder locationMode = mode
- StringBuilder name = new StringBuilder()
- StringBuilder temperatureScale = new StringBuilder()
+ // id, label, and display name of the device
+ String id
+ String label
+ String displayName
// Maps from features to values
- HashMap<String, StringBuilder> deviceValuesMap = new HashMap<String, StringBuilder>()
+ HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
+ HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
// Other variables
Phrase helloHome
TimeZone timeZone
List phoneNumbers
LocationVar(Closure sendEvent, boolean init) {
- deviceValuesMap = deviceValueSmartThing
+ deviceValueSmartThing = deviceValuesMap
+ deviceIntValueSmartThing = deviceIntValuesMap
+ idSmartThing = id
+ labelSmartThing = label
+ displayNameSmartThing = displayName
sendEventSmartThings = sendEvent
// Initialization
- StringBuilder sunset = new StringBuilder("sunset")
- StringBuilder sunsetTime = sunset
- StringBuilder sunrise = new StringBuilder("sunrise")
- StringBuilder sunriseTime = sunrise
- hubs = [[id:0, localIP:"128.195.204.105"]]
- modes = [[name: "home"],[name: "away"],[name: "night"]]
helloHome = new Phrase()
- contactBookEnabled.setValue(1)
contacts = ['AJ']
phoneNumbers = [9495379373]
- name.append("hub0")
- temperatureScale.append("F")
+ modes = [[name: "home"],[name: "away"],[name: "night"]]
timeZone = TimeZone.getTimeZone("America/New_York")
-
+ hubs = [[id:0, localIP:"128.195.204.105"]]
if (init)
mode.append("away")
mode.append("home")
deviceValuesMap.put("mode", mode)
- deviceValuesMap.put("Location", 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)
}
-
- // Methods to return values
- def getMode() {
- return mode.toString()
- }
-
- def getLocationMode() {
- return locationMode.toString()
- }
-
- def getName() {
- return name.toString()
- }
-
- def getTemperatureScale() {
- return temperatureScale.toString()
- }
-
- def getContactBookEnabled() {
- return contactBookEnabled.getValue()
- }
}