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]
/
ContactSensor
/
ContactSensor.groovy
diff --git
a/ContactSensor/ContactSensor.groovy
b/ContactSensor/ContactSensor.groovy
index 91fdfd1f409a73a600893ee83a5a19c353c2f4e0..e93ce58909cddc0ca60f90064f305a358b764fc8 100644
(file)
--- a/
ContactSensor/ContactSensor.groovy
+++ b/
ContactSensor/ContactSensor.groovy
@@
-4,18
+4,16
@@
import SmartThing.SmartThing
public class ContactSensor extends SmartThing {
// id, label, and display name of the device
public class ContactSensor 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 currentContact = 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
>();
- ContactSensor(Closure sendEvent, String
Builder id, StringBuilder label, StringBuilder displayName, StringBuilder
currentContact) {
- deviceValue
sMap = deviceValueSmartThing
+ ContactSensor(Closure sendEvent, String
id, String label, String displayName, String
currentContact) {
+ deviceValue
SmartThing = deviceValuesMap
idSmartThing = id
labelSmartThing = label
displayNameSmartThing = displayName
idSmartThing = id
labelSmartThing = label
displayNameSmartThing = displayName
@@
-26,15
+24,9
@@
public class ContactSensor extends SmartThing {
this.id = id
this.label = label
this.displayName = displayName
this.id = id
this.label = label
this.displayName = displayName
- this.currentContact = currentContact
possibleValues.add("closed")
possibleValues.add("open")
deviceValuesMap.put("contact", currentContact)
}
possibleValues.add("closed")
possibleValues.add("open")
deviceValuesMap.put("contact", currentContact)
}
-
- // Methods to return values
- def getCurrentContact() {
- return currentContact.toString()
- }
}
}