X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=MotionSensor%2FMotionSensor.groovy;h=5cb2befd50c414142ab6338f8fe025912545eab9;hb=2d26e7af07daad1394408bdcf76150b5aacf3a8a;hp=85b5618f016275dba3cd8df56d9dff5fc02ae647;hpb=83071d3bcfc33f015ece13868342644498a9dda3;p=smartthings-infrastructure.git diff --git a/MotionSensor/MotionSensor.groovy b/MotionSensor/MotionSensor.groovy index 85b5618..5cb2bef 100644 --- a/MotionSensor/MotionSensor.groovy +++ b/MotionSensor/MotionSensor.groovy @@ -4,18 +4,16 @@ import SmartThing.SmartThing 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 deviceValuesMap = new HashMap() + HashMap deviceValuesMap = new HashMap() // Possible values for eventsSince method - List possibleValues = new ArrayList(); + List possibleValues = new ArrayList(); - 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 @@ -26,15 +24,9 @@ public class MotionSensor extends SmartThing { 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() - } }