public class MotionSensor extends SmartThing {
// id, label, and display name of the device
- StringBuilder id = new StringBuilder()
- StringBuilder label = new StringBuilder()
- StringBuilder displayName = new StringBuilder()
- // Features with string values
- StringBuilder currentMotion = new StringBuilder()
+ 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>()
// Possible values for eventsSince method
- List<StringBuilder> possibleValues = new ArrayList<StringBuilder>();
+ List<String> possibleValues = new ArrayList<String>();
- MotionSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentMotion) {
- deviceValuesMap = deviceValueSmartThing
+ MotionSensor(Closure sendEvent, String id, String label, String displayName, String currentMotion) {
+ deviceValueSmartThing = deviceValuesMap
idSmartThing = id
labelSmartThing = label
displayNameSmartThing = displayName
this.id = id
this.label = label
this.displayName = displayName
- this.currentMotion = currentMotion
possibleValues.add("active")
possibleValues.add("inactive")
deviceValuesMap.put("motion", currentMotion)
}
-
- // Methods to return values
- def getCurrentMotion() {
- return currentMotion.toString()
- }
}