Removing getXXX methods + properties. Adding getProperty feature to SmartThing(s)
[smartthings-infrastructure.git] / BeaconSensor / BeaconSensor.groovy
index be77c046b78c1ee08be3c0c5ec52774ab1810d11..6ea78f12e1f4cdc5af071ebe6816133eb201913f 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class BeaconSensor 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 currentPresence = 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>()
 
-       BeaconSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentPresence) {
-               deviceValuesMap = deviceValueSmartThing
+       BeaconSensor(Closure sendEvent, String id, String label, String displayName, String currentPresence) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,13 +21,7 @@ public class BeaconSensor extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentPresence = currentPresence
                
-               deviceValuesMap.put("beacon", currentPresence)
-       }
-
-       // Methods to return values
-       def getCurrentPresence() {
-               return currentPresence.toString()
+               deviceValuesMap.put("presence", currentPresence)
        }
 }