projects
/
smartthings-infrastructure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removing getXXX methods + properties. Adding getProperty feature to SmartThing(s)
[smartthings-infrastructure.git]
/
MotionSensor
/
MotionSensor.groovy
diff --git
a/MotionSensor/MotionSensor.groovy
b/MotionSensor/MotionSensor.groovy
index 85b5618f016275dba3cd8df56d9dff5fc02ae647..5cb2befd50c414142ab6338f8fe025912545eab9 100644
(file)
--- 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
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
// Maps from features to values
- HashMap<String, String
Builder> deviceValuesMap = new HashMap<String, StringBuilder
>()
+ HashMap<String, String
> deviceValuesMap = new HashMap<String, String
>()
// Possible values for eventsSince method
// Possible values for eventsSince method
- List<String
Builder> possibleValues = new ArrayList<StringBuilder
>();
+ List<String
> possibleValues = new ArrayList<String
>();
- MotionSensor(Closure sendEvent, String
Builder id, StringBuilder label, StringBuilder displayName, StringBuilder
currentMotion) {
- deviceValue
sMap = deviceValueSmartThing
+ MotionSensor(Closure sendEvent, String
id, String label, String displayName, String
currentMotion) {
+ deviceValue
SmartThing = deviceValuesMap
idSmartThing = id
labelSmartThing = label
displayNameSmartThing = displayName
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.id = id
this.label = label
this.displayName = displayName
- this.currentMotion = currentMotion
possibleValues.add("active")
possibleValues.add("inactive")
deviceValuesMap.put("motion", currentMotion)
}
possibleValues.add("active")
possibleValues.add("inactive")
deviceValuesMap.put("motion", currentMotion)
}
-
- // Methods to return values
- def getCurrentMotion() {
- return currentMotion.toString()
- }
}
}