Removing getXXX methods + properties. Adding getProperty feature to SmartThing(s)
authoramiraj <amiraj.95@uci.edu>
Wed, 29 Jan 2020 19:07:47 +0000 (11:07 -0800)
committeramiraj <amiraj.95@uci.edu>
Wed, 29 Jan 2020 19:07:47 +0000 (11:07 -0800)
85 files changed:
AccelerationSensor/AccelerationSensor.groovy
AccelerationSensor/AccelerationSensors.groovy
AeonKeyFob/AeonKeyFob.groovy
AeonKeyFob/AeonKeyFobs.groovy
Alarm/Alarm.groovy
Alarm/Alarms.groovy
Battery/Batteries.groovy
Battery/Battery.groovy
BeaconSensor/BeaconSensor.groovy
BeaconSensor/BeaconSensors.groovy
Button/Button.groovy
Button/Buttons.groovy
CarbonMonoxideDetector/CarbonMonoxideDetector.groovy
CarbonMonoxideDetector/CarbonMonoxideDetectors.groovy
ColorControl/ColorControl.groovy
ColorControl/ColorControls.groovy
ColorTemperature/ColorTemperature.groovy
ColorTemperature/ColorTemperatures.groovy
ContactSensor/ContactSensor.groovy
ContactSensor/ContactSensors.groovy
DoorControl/DoorControl.groovy
DoorControl/DoorControls.groovy
EnergyMeter/EnergyMeter.groovy
EnergyMeter/EnergyMeters.groovy
IlluminanceMeasurement/IlluminanceMeasurement.groovy
IlluminanceMeasurement/IlluminanceMeasurements.groovy
ImageCapture/ImageCapture.groovy
ImageCapture/ImageCaptures.groovy
Location/LocationVar.groovy
Lock/Lock.groovy
Lock/Locks.groovy
Methods/setLocationMode.groovy
Methods/subscribe.groovy
MobilePresence/MobilePresence.groovy
MobilePresence/MobilePresences.groovy
Momentary/Momentaries.groovy
Momentary/Momentary.groovy
MotionSensor/MotionSensor.groovy
MotionSensor/MotionSensors.groovy
MusicPlayer/MusicPlayer.groovy
MusicPlayer/MusicPlayers.groovy
MutableInteger/MutableInteger.groovy [deleted file]
NfcTouch/NfcTouch.groovy
PowerMeter/PowerMeter.groovy
PowerMeter/PowerMeters.groovy
PresenceSensor/PresenceSensor.groovy
PresenceSensor/PresenceSensors.groovy
RelativeHumidityMeasurement/RelativeHumidityMeasurement.groovy
RelativeHumidityMeasurement/RelativeHumidityMeasurements.groovy
RelaySwitch/RelaySwitch.groovy
RelaySwitch/RelaySwitches.groovy
SleepSensor/SleepSensor.groovy
SleepSensor/SleepSensors.groovy
SmartThing/SmartThing.groovy
SmartThing/SmartThings.groovy
SmokeDetector/SmokeDetector.groovy
SmokeDetector/SmokeDetectors.groovy
SpeechSynthesis/SpeechSynthesis.groovy
SpeechSynthesis/SpeechSynthesises.groovy
StepSensor/StepSensor.groovy
StepSensor/StepSensors.groovy
Switch/Switch.groovy
Switch/Switches.groovy
SwitchLevel/SwitchLevel.groovy
SwitchLevel/SwitchLevels.groovy
TemperatureMeasurement/TemperatureMeasurement.groovy
TemperatureMeasurement/TemperatureMeasurements.groovy
Thermostat/Thermostat.groovy
Thermostat/Thermostats.groovy
ThreeAxis/ThreeAxis.groovy
ThreeAxis/ThreeAxises.groovy
Valve/Valve.groovy
Valve/Valves.groovy
WaterSensor/WaterSensor.groovy
WaterSensor/WaterSensors.groovy
appTouch/Touched.groovy
eventSimulator/doorClosedEvent.groovy
eventSimulator/doorOpenEvent.groovy
eventSimulator/locationAwayEvent.groovy
eventSimulator/locationHomeEvent.groovy
eventSimulator/locationNightEvent.groovy
eventSimulator/modeHomeEvent.groovy
eventSimulator/motionActiveEvent.groovy
eventSimulator/nfcTouchEvent.groovy
eventSimulator/unlockEvent.groovy

index 3352e7d8b30bbab777a41e2d650460c6c744d030..66cae29667a2c4526bae52af63f3562b1166ea83 100644 (file)
@@ -4,38 +4,29 @@ import SmartThing.SmartThing
 
 public class AccelerationSensor 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 currentAcceleration = 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>();
 
-       AccelerationSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentAcceleration) {
-               deviceValuesMap = deviceValueSmartThing
-               deviceIntValuesMap = deviceIntValueSmartThing
+       AccelerationSensor(Closure sendEvent, String id, String label, String displayName, String currentAcceleration) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
-               sendEventSmartThings = sendEvent
                possibleValuesSmartThings = possibleValues
+               sendEventSmartThings = sendEvent
 
                // Initialization
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentAcceleration = currentAcceleration
                possibleValues.add("active")
                possibleValues.add("inactive")
 
                deviceValuesMap.put("acceleration", currentAcceleration)
        }
-
-       // Methods to return values
-       def getCurrentAcceleration() {
-               return currentAcceleration.toString()
-       }
 }
index 58276228e35436f5ff030675eceb2b15bf65bed8..c218c2f813d0a7b637337f7c00a90034f97ab841 100644 (file)
@@ -9,24 +9,17 @@ public class AccelerationSensors extends SmartThings {
                accelerationSensors = smartThings
 
                // Initialize
-               StringBuilder id = new StringBuilder("accelerationID0")
-               StringBuilder label = new StringBuilder("acceleration")
-               StringBuilder displayName = new StringBuilder("acceleration0")
-               StringBuilder acceleration = new StringBuilder()
+               String id = "accelerationID0"
+               String label = "acceleration"
+               String displayName = "accelerationSensor"
+               String acceleration
 
                // Initialization
                if (init)
-                       acceleration.append("inactive")
+                       acceleration = "inactive"
                else
-                       acceleration.append("active")
+                       acceleration = "active"
 
                accelerationSensors.add(new AccelerationSensor(sendEvent, id, label, displayName, acceleration))
        }
-
-       // Methods to return values
-       def getCurrentAcceleration() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(accelerationSensors[0].getCurrentAcceleration())
-               return tmpValues
-       }
 }
index 6fcdb78f68b8e84b8add0d8d20d002fd6b40135b..f08cd0719128a96a8ee243648b8b5dfac13bb323 100644 (file)
@@ -4,18 +4,18 @@ import SmartThing.SmartThing
 
 public class AeonKeyFob extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
+       String id
+       String label
+       String displayName
        // Possible values for eventsSince method
-       List<StringBuilder> possibleValues = new ArrayList<StringBuilder>();
+       List<String> possibleValues = new ArrayList<String>()
 
-       AeonKeyFob(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName) {
+       AeonKeyFob(Closure sendEvent, String id, String label, String displayName) {
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
-               sendEventSmartThings = sendEvent
                possibleValuesSmartThings = possibleValues
+               sendEventSmartThings = sendEvent
 
                // Initialization
                this.id = id
index bbb45b3e0151bed4e5bd5aa6ecd68bc2d986c609..c3dd087c841cb4443064d0e1be52ce367f58ce7a 100644 (file)
@@ -9,9 +9,9 @@ public class AeonKeyFobs extends SmartThings {
                aeonKeyFobs = smartThings
                
                // Initialization
-               StringBuilder id = new StringBuilder("aeonKeyFobID0")
-               StringBuilder label = new StringBuilder("button")
-               StringBuilder displayName = new StringBuilder("aeonKeyFob0")
+               String id = "aeonKeyFobID0"
+               String label = "button"
+               String displayName = "aeonKeyFob"
 
                aeonKeyFobs.add(new AeonKeyFob(sendEvent, id, label, displayName))
        }
index f03f5d6952897d43937bf20d6d0a2d42e4c2b4f1..a5cd6f0dca5a62fba267d0702297f6baaacd589c 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class Alarm 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 currentAlarm = 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>()
 
-       Alarm(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentAlarm) {
-               deviceValuesMap = deviceValueSmartThing
+       Alarm(Closure sendEvent, String id, String label, String displayName, String currentAlarm) {
+               deviceValueSmartThing = deviceValuesMap 
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,44 +21,28 @@ public class Alarm extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentAlarm = currentAlarm
 
                deviceValuesMap.put("alarm", currentAlarm)
        }
 
        // Methods to set values
        def both() {
-               action("both")
+               action("both", "alarm")
        }
 
        def on() {
-               action("both")
+               action("both", "alarm")
        }
 
        def off() {
-               action("off")
+               action("off", "alarm")
        }
 
        def siren() {
-               action("siren")
+               action("siren", "alarm")
        }
 
        def strobe() {
-               action("strobe")
-       }
-
-       def action(String newValue) {
-               if (!currentAlarm.equals(newValue)) {
-                       String tmpID = id.toString()
-                       currentAlarm.replace(0, currentAlarm.length(), newValue)
-                       println("the alarm with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: "alarm", value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentAlarm() {
-               return currentAlarm.toString()
+               action("strobe", "alarm")
        }
 }
index ac37de69feffeec7a48e15418da79f4904ceae63..580e65cd5063b6a35dfc80ee86535fe141921e38 100644 (file)
@@ -9,15 +9,15 @@ public class Alarms extends SmartThings {
                alarms = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("alarmID0")
-               StringBuilder label = new StringBuilder("alarm")
-               StringBuilder displayName = new StringBuilder("alarm0")
-               StringBuilder alarm = new StringBuilder()
+               String id = "alarmID0"
+               String label = "alarm"
+               String displayName = "alarmSensor"
+               String alarm
        
                if (init)
-                       alarm.append("off")
+                       alarm = "off"
                else
-                       alarm.append("on")
+                       alarm = "on"
                
                alarms.add(new Alarm(sendEvent, id, label, displayName, alarm))
        }
@@ -42,11 +42,4 @@ public class Alarms extends SmartThings {
        def strobe() {
                alarms[0].strobe()
        }
-
-       // Methods to return values
-       def getCurrentAlarm() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(alarms[0].getCurrentAlarm())
-               return tmpValues
-       }
 }
index 20f213a1a20a56c1e6e3f99f93598c755b009e06..636a69cd2253ddae24a4c0a47b9567b31515c04e 100644 (file)
@@ -2,33 +2,23 @@
 package Battery
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class Batteries extends SmartThings {
        List batteries = new ArrayList()
 
        Batteries(Closure sendEvent, boolean init) {
                batteries = smartThings
 
-               StringBuilder id = new StringBuilder("batteryID0")
-               StringBuilder label = new StringBuilder("battery")
-               StringBuilder displayName = new StringBuilder("battery0")
-               MutableInteger battery = new MutableInteger()
-
                // Initialization
+               String id = "batteryID0"
+               String label = "battery"
+               String displayName = "batteryDevice"
+               Integer battery
+
                if (init)
-                       battery.setValue(50)
+                       battery = 50
                else
-                       battery.setValue(0)
+                       battery = 0
 
                batteries.add(new Battery(sendEvent, id, label, displayName, battery))
        }
-
-       // Methods to return values
-       def getCurrentBattery() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(batteries[0].getCurrentBattery())
-               return tmpValues
-       }
 }
index 3e4e5116e8047f7c911f39b929bcec9583870f79..7162d6824066efdc7fb6b2f6dcb9cbab6f508dc9 100644 (file)
@@ -2,21 +2,16 @@
 package Battery
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class Battery extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentBattery = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       Battery(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentBattery) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       Battery(Closure sendEvent, String id, String label, String displayName, Integer currentBattery) {
+               deviceIntValueSmartThing = deviceIntValuesMap 
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,13 +21,7 @@ public class Battery extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentBattery = currentBattery
 
                deviceIntValuesMap.put("battery", currentBattery)
        }
-
-       // Methods to return values
-       def getCurrentBattery() {
-               return currentBattery.toString()
-       }
 }
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)
        }
 }
index c5b4cf62e5585b9c2119b5a8f2d91ba79e6230f1..6bc33106737944e1296ed44c55d1ee4d313e760f 100644 (file)
@@ -9,23 +9,16 @@ public class BeaconSensors extends SmartThings {
                beaconSensors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("beaconID0")
-               StringBuilder label = new StringBuilder("beacon")
-               StringBuilder displayName = new StringBuilder("beacon0")
-               StringBuilder presence = new StringBuilder()
+               String id = "beaconID0"
+               String label = "beacon"
+               String displayName = "beaconSensor"
+               String presence
 
                if (init)
-                       presence.append("not present")
+                       presence = "not present"
                else
-                       presence.append("present")
+                       presence = "present"
 
                beaconSensors.add(new BeaconSensor(sendEvent, id, label, displayName, presence))
        }
-
-       // Methods to return values
-       def getCurrentPresence() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(beaconSensors[0].getCurrentPresence())
-               return tmpValues
-       }
 }
index bb0399e0f0757ba9469209f51e37fb06d0a822fd..37a09cf834d937a7de083fb1efd3e552aa7b1cda 100644 (file)
@@ -4,13 +4,13 @@ import SmartThing.SmartThing
 
 public class Button extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
+       String id
+       String label
+       String displayName
        // Possible values for eventsSince method
-       List<StringBuilder> possibleValues = new ArrayList<StringBuilder>();
+       List<String> possibleValues = new ArrayList<String>();
 
-       Button(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName) {
+       Button(Closure sendEvent, String id, String label, String displayName) {
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
index 2b94073dd8d803481ccebec58ba5a6106f556364..8b9d4176bc89cc734b36b2d4f0e903619ab634ca 100644 (file)
@@ -9,9 +9,9 @@ public class Buttons extends SmartThings {
                buttons = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("buttonID0")
-               StringBuilder label = new StringBuilder("button")
-               StringBuilder displayName = new StringBuilder("button0")
+               String id = "buttonID0"
+               String label = "button"
+               String displayName = "buttonController"
 
                buttons.add(new Button(sendEvent, id, label, displayName))
        }
index 65f1ce0d99bf1209a2988e8888753d287fb1b6fc..045a415668fa4e08a2b0d13858583b3d46104813 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class CarbonMonoxideDetector 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 currentCarbonMonoxideValue = 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>()
 
-       CarbonMonoxideDetector(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentCarbonMonoxideValue) {
-               deviceValuesMap = deviceValueSmartThing
+       CarbonMonoxideDetector(Closure sendEvent, String id, String label, String displayName, String currentCarbonMonoxideValue) {
+               deviceValueSmartThing = deviceValuesMap 
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,13 +21,7 @@ public class CarbonMonoxideDetector extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentCarbonMonoxideValue = currentCarbonMonoxideValue
 
                deviceValuesMap.put("carbonMonoxide", currentCarbonMonoxideValue)
        }
-
-       // Methods to return values
-       def getCurrentCarbonMonoxideValue() {
-               return currentCarbonMonoxideValue.toString()
-       }
 }
index 162ca8dc66a14558cd9e143cbd99989fa6a941fd..1b636002c48cad50f3a9689868c588e3f0f39ca2 100644 (file)
@@ -9,23 +9,16 @@ public class CarbonMonoxideDetectors extends SmartThings {
                carbonMonoxideDetectors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("carbonMonoxideID0")
-               StringBuilder label = new StringBuilder("carbonMonoxide")
-               StringBuilder displayName = new StringBuilder("carbonMonoxide0")
-               StringBuilder carbonMonoxide = new StringBuilder()
+               String id = "carbonMonoxideID0"
+               String label = "carbonMonoxide"
+               String displayName = "carbonMonoxideDetector"
+               String carbonMonoxide
 
                if (init)
-                       carbonMonoxide.append("clear")
+                       carbonMonoxide = "clear"
                else
-                       carbonMonoxide.append("detected")
+                       carbonMonoxide = "detected"
 
                carbonMonoxideDetectors.add(new CarbonMonoxideDetector(sendEvent, id, label, displayName, carbonMonoxide))
        }
-
-       // Methods to return values
-       def getCurrentCarbonMonoxideValue() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(carbonMonoxideDetectors[0].getCurrentCarbonMonoxideValue())
-               return tmpValues
-       }
 }
index c278f4ae3a8fb6d73c50cee473c867b3df713058..4380f24408c0c5534d994ae06440b5625101a79c 100644 (file)
@@ -2,26 +2,18 @@
 package ColorControl
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class ColorControl extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentHue = new MutableInteger()
-       MutableInteger currentSaturation = new MutableInteger()
-       // Features with string values
-       StringBuilder currentColor = new StringBuilder()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, StringBuilder> deviceValuesMap = new HashMap<String, StringBuilder>()
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       ColorControl(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentColor, MutableInteger currentHue, MutableInteger currentSaturation) {
-               deviceValuesMap = deviceValueSmartThing
-               deviceIntValuesMap = deviceIntValueSmartThing
+       ColorControl(Closure sendEvent, String id, String label, String displayName, String currentColor, Integer currentHue, Integer currentSaturation) {
+               deviceValueSmartThing = deviceValuesMap
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -31,9 +23,6 @@ public class ColorControl extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentHue = currentHue
-               this.currentSaturation = currentSaturation
-               this.currentColor = currentColor
 
                deviceValuesMap.put("color", currentColor)
                deviceIntValuesMap.put("hue", currentHue)
@@ -74,11 +63,11 @@ public class ColorControl extends SmartThing {
 
        // Methods to set values
        def setColor(String newValue) {
-               action(currentColor, newValue, "color")
+               action(newValue, "color")
        }
 
        def setHue(int newValue) {
-               action(currentHue, newValue, "hue")
+               action(newValue, "hue")
        }
        
        def setHue(double newValue) {
@@ -86,43 +75,10 @@ public class ColorControl extends SmartThing {
        }
 
        def setSaturation(int newValue) {
-               action(currentSaturation, newValue, "saturation")
+               action(newValue, "saturation")
        }
        
        def setSaturation(double newValue) {
                setSaturation((int) newValue)
        }
-
-       def action(StringBuilder variable, String newValue, String feature) {
-               if (!variable.toString().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.replace(0, variable.length(), newValue)
-                       println("$feature of the light with id:$id is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       def action(MutableInteger variable, int newValue, String feature) {
-               if (!variable.getValue().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.setValue(newValue)
-                       println("$feature of the light with id:$id is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentHue() {
-               return currentHue.getValue()
-       }
-
-       def getCurrentSaturation() {
-               return currentSaturation.getValue()
-       }
-       
-       def getCurrentColor() {
-               return currentColor.toString()
-       }
 }
index c74f99b82ae16b2f56cee33b377d0cc7d74eb2cf..68fd6f0b1eed47095fcd38a8edd0b213be82eafe 100644 (file)
@@ -13,21 +13,21 @@ public class ColorControls extends SmartThings {
                colorControls = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("colorControlID0")
-               StringBuilder label = new StringBuilder("colorControl")
-               StringBuilder displayName = new StringBuilder("colorControl0")
-               StringBuilder color = new StringBuilder()
-               MutableInteger hue = new MutableInteger()
-               MutableInteger saturation = new MutableInteger()
+               String id = "colorControlID0"
+               String label = "colorControl"
+               String displayName = "light"
+               String color
+               Integer hue
+               Integer saturation
 
                if (init) {
-                       color.append("Red")
-                       hue.setValue(30)
-                       saturation.setValue(40)
+                       color = "Red"
+                       hue = 30
+                       saturation = 40
                } else {                
-                       color.append("Blue")
-                       hue.setValue(50)
-                       saturation.setValue(50)
+                       color = "Blue"
+                       hue = 50
+                       saturation = 50
                }
 
                colorControls.add(new ColorControl(sendEvent, id, label, displayName, color, hue,
@@ -66,23 +66,4 @@ public class ColorControls extends SmartThings {
        def off() {
                colorControls[0].off()
        }
-
-       // Methods to return values
-       def getCurrentHue() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(colorControls[0].getCurrentHue())
-               return tmpValues
-       }
-
-       def getCurrentSaturation() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(colorControls[0].getCurrentSaturation())
-               return tmpValues
-       }
-       
-       def getCurrentColor() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(colorControls[0].getCurrentColor())
-               return tmpValues
-       }
 }
index 6cb9b397ae7290549c9b37f2984559486b777bcd..08f91be8d858e31a639f4792cda9658be9696fab 100644 (file)
@@ -2,21 +2,16 @@
 package ColorTemperature
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class ColorTemperature extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentColorTemperature = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       ColorTemperature(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger colorTemperature) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       ColorTemperature(Closure sendEvent, String id, String label, String displayName, Integer colorTemperature) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,24 +21,12 @@ public class ColorTemperature extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentColorTemperature = currentColorTemperature
 
                deviceIntValuesMap.put("colorTemperature", currentColorTemperature)
        }
 
        // Methods to set values
        def setColorTemperature(int newValue) {
-               if (!currentColorTemperature.getValue().equals(newValue)) {
-                       String tmpID = id.toString()
-                       currentColorTemperature.setValue(newValue)
-                       println("The color temperature of the light with id $tmpID is changed to $newValue!")
-                       sendEvent([name: "colorTemperature", value: "$newValue", deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentColorTemperature() {
-               return currentColorTemperature.getValue()
+               action(newValue, "colorTemperature")
        }
 }
index 5e70db65e6d360dc823c18e1efe974082c4d2980..1cc0aaa3190bf65da70b70f48d63feadad6a764b 100644 (file)
@@ -2,9 +2,6 @@
 package ColorTemperature
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class ColorTemperatures extends SmartThings {
        List colorTemperatues = new ArrayList()
 
@@ -13,10 +10,10 @@ public class ColorTemperatures extends SmartThings {
                colorTemperatues = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("colorTemperatureID0")
-               StringBuilder label = new StringBuilder("colorTemperature")
-               StringBuilder displayName = new StringBuilder("colorTemperature0")
-               MutableInteger colorTemperatue = new MutableInteger()
+               String id = "colorTemperatureID0"
+               String label = "colorTemperature"
+               String displayName = "light"
+               Integer colorTemperatue
 
                if (init)
                        colorTemperature = 10000
@@ -30,11 +27,4 @@ public class ColorTemperatures extends SmartThings {
        def setColorTemperature(int newValue) {
                colorTemperatues[0].setColorTemperature(newValue)
        }
-
-       // Methods to return values
-       def getCurrentColorTemperature() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(colorTemperatues[0].getCurrentColorTemperature())
-               return tmpValues
-       }
 }
index 91fdfd1f409a73a600893ee83a5a19c353c2f4e0..e93ce58909cddc0ca60f90064f305a358b764fc8 100644 (file)
@@ -4,18 +4,16 @@ import SmartThing.SmartThing
 
 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
-       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>();
 
-       ContactSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentContact) {
-               deviceValuesMap = deviceValueSmartThing
+       ContactSensor(Closure sendEvent, String id, String label, String displayName, String currentContact) {
+               deviceValueSmartThing = deviceValuesMap
                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.currentContact = currentContact
                possibleValues.add("closed")
                possibleValues.add("open")
 
                deviceValuesMap.put("contact", currentContact)
        }
-
-       // Methods to return values
-       def getCurrentContact() {
-               return currentContact.toString()
-       }
 }
index 9889793eb3bdd6296434fe51da5d06089897dcfd..0e4130eff75bf88767f15781527ffbe783ac0d76 100644 (file)
@@ -10,23 +10,16 @@ public class ContactSensors extends SmartThings {
                contacts = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("contactID0")
-               StringBuilder label = new StringBuilder("contact")
-               StringBuilder displayName = new StringBuilder("contact0")
-               StringBuilder currentContact = new StringBuilder()
+               String id = "contactID0"
+               String label = "contact"
+               String displayName = "contactSensor"
+               String currentContact
                
                if (init)
-                       currentContact.append("closed")
+                       currentContact = "closed"
                else
-                       currentContact.append("open")
+                       currentContact = "open"
 
                contacts.add(new ContactSensor(sendEvent, id, label, displayName, currentContact))
        }
-
-       // Methods to return values
-       def getCurrentContact() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(contacts[0].getCurrentContact())
-               return tmpValues
-       }
 }
index d0027273b4260ab0e18e27f22070ca050a722dd0..a72e5f7c126a20a622759526bebec9ed5c491994 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class DoorControl 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 currentDoorState = 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>()
 
-       DoorControl(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentDoorState) {
-               deviceValuesMap = deviceValueSmartThing
+       DoorControl(Closure sendEvent, String id, String label, String displayName, String currentDoor) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,14 +21,13 @@ public class DoorControl extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentDoorState = currentDoorState
 
-               deviceValuesMap.put("status", currentDoorState)
+               deviceValuesMap.put("door", currentDoor)
        }
 
        // Methods to set values
        def open() {
-               action(currentDoorState, "open", "status")
+               action("open", "door")
        }
 
        def open(LinkedHashMap metaData) {
@@ -38,25 +35,10 @@ public class DoorControl extends SmartThing {
        }
 
        def close() {
-               action(currentDoorState, "closed", "status")
+               action("closed", "door")
        }
 
        def close(LinkedHashMap metaData) {
                close()
        }
-
-       def action(StringBuilder variable, String newValue, String feature) {
-               if (!variable.toString().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.replace(0, variable.length(), newValue)
-                       println("$feature of the door with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentDoorState() {
-               return currentDoorState.toString()
-       }
 }
index 069a161c7f379d63b806a468a0e87990c25d1394..c9630d8b2cee0cf5b8cc422c8acbcbfecc3dfe7a 100644 (file)
@@ -10,17 +10,17 @@ public class DoorControls extends SmartThings {
                doorControls = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("doorControlID0")
-               StringBuilder label = new StringBuilder("doorControl")
-               StringBuilder displayName = new StringBuilder("doorControl0")
-               StringBuilder doorState = new StringBuilder()
+               String id = "doorControlID0"
+               String label = "doorControl"
+               String displayName = "doorController"
+               String door
 
                if (init)
-                       doorState.append("open")
+                       door = "open"
                else
-                       doorState.append("closed")
+                       door = "closed"
 
-               doorControls.add(new DoorControl(sendEvent, id, label, displayName, doorState))
+               doorControls.add(new DoorControl(sendEvent, id, label, displayName, door))
        }
 
        // Methods to set values
@@ -39,11 +39,4 @@ public class DoorControls extends SmartThings {
        def close(LinkedHashMap metaData) {
                close()
        }
-
-       // Methods to return values
-       def getCurrentDoorState() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(doorControls[0].getCurrentDoorState())
-               return tmpValues
-       }
 }
index 9324ca3629fcd3d6dc1bc40e157f902f5169c507..f41c7412d53711c92b2989bfe604af9fb5352dd3 100644 (file)
@@ -2,21 +2,16 @@
 package EnergyMeter
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class EnergyMeter extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentEnergy = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       EnergyMeter(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentEnergy) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       EnergyMeter(Closure sendEvent, String id, String label, String displayName, Integer currentEnergy) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,13 +21,7 @@ public class EnergyMeter extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentEnergy = currentEnergy
 
                deviceIntValuesMap.put("energy", currentEnergy)
        }
-
-       // Methods to return values
-       def getCurrentEnergy() {
-               return currentEnergy.getValue()
-       }
 }
index 3722a2ba8b3e6c8cd8a8edf56d5d042712d71ba8..1cb2839a3bc33d3b6c274c1b77e2ec59ed7209b8 100644 (file)
@@ -2,9 +2,6 @@
 package EnergyMeter
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class EnergyMeters extends SmartThings {
        List energyMeters = new ArrayList()
 
@@ -13,23 +10,16 @@ public class EnergyMeters extends SmartThings {
                energyMeters = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("energyID0")
-               StringBuilder label = new StringBuilder("energy")
-               StringBuilder displayName = new StringBuilder("energy0")
-               MutableInteger energy = new MutableInteger()
+               String id = "energyID0"
+               String label = "energy"
+               String displayName = "energyMeter"
+               Integer energy
 
                if (init)
-                       energy.setValue(50)
+                       energy = 50
                else
-                       energy.setValue(60)
+                       energy = 60
 
                energyMeters.add(new EnergyMeter(sendEvent, id, label, displayName, energy))
        }
-
-       // Methods to return values
-       def getCurrentEnergy() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(energyMeters[0].getCurrentEnergy())
-               return tmpValues
-       }
 }
index 85ae10a9f49897271c1556e981056a643d0abb2e..c62d9d845ec23c404aedc18c91d71bbb36ce9871 100644 (file)
@@ -2,21 +2,16 @@
 package IlluminanceMeasurement
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class IlluminanceMeasurement extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentIlluminance = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       IlluminanceMeasurement(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentIlluminance) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       IlluminanceMeasurement(Closure sendEvent, String id, String label, String displayName, Integer currentIlluminance) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,13 +21,7 @@ public class IlluminanceMeasurement extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentIlluminance = currentIlluminance
 
                deviceIntValuesMap.put("illuminance", currentIlluminance)
        }
-
-       // Methods to return values
-       def getCurrentIlluminance() {
-               return currentIlluminance.getValue()
-       }
 }
index 0944a02a7c6e4b43501f246de2e38198ca0bdbf7..5977e4682b9fd8b70968137b5dbbf84cbf4ef315 100644 (file)
@@ -2,34 +2,23 @@
 package IlluminanceMeasurement
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class IlluminanceMeasurements extends SmartThings {
        List illuminanceMeasurements = new ArrayList()
                
        IlluminanceMeasurements(Closure sendEvent, boolean init) {
-               // Only initialize one time since we only have one device for each capability
                illuminanceMeasurements = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("illuminanceID0")
-               StringBuilder label = new StringBuilder("illuminance")
-               StringBuilder displayName = new StringBuilder("illuminance0")
-               MutableInteger illuminance = new MutableInteger()
+               String id = "illuminanceID0"
+               String label = "illuminance"
+               String displayName = "illuminanceSensor"
+               Integer illuminance
 
                if (init)
-                       illuminance.setValue(20000)
+                       illuminance = 20000
                else
-                       illuminance.setValue(5)
+                       illuminance = 5
 
                illuminanceMeasurements.add(new IlluminanceMeasurement(sendEvent, id, label, displayName, illuminance))
        }
-
-       // Methods to return values
-       def getCurrentIlluminance() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(illuminanceMeasurements[0].getCurrentIlluminance())
-               return tmpValues
-       }
 }
index a8ab0ee19e7c63c9ef025db35ccd2edee5394cab..1ba517e9e0d54b5df1d049b79d84d73d9ad5e2c8 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class ImageCapture 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 currentImage = 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>()
 
-       ImageCapture(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentImage) {
-               deviceValuesMap = deviceValueSmartThing
+       ImageCapture(Closure sendEvent, String id, String label, String displayName, String currentImage) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,22 +21,15 @@ public class ImageCapture extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentImage = currentImage
 
                deviceValuesMap.put("image", currentImage)
        }
 
        def take() {
-               String tmpID = id.toString()
-               println("The camera with id:$tmpID is taken a picture!")
+               println("The camera with id:$id is taken a picture!")
        }
 
        def take(LinkedHashMap metaData) {
                take()
        }
-
-       // Methods to return values
-       def getCurrentImage() {
-               return currentImage.toString()
-       }
 }
index 0b6c44756cf44ff092c57eccbefc7413f8b3fe14..befb42b919b5a7589b849b657e7f518dd60bd8e2 100644 (file)
@@ -10,10 +10,10 @@ public class ImageCaptures extends SmartThings {
                imageCaptureSensors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("imageCaptureID0")
-               StringBuilder label = new StringBuilder("imageCapture")
-               StringBuilder displayName = new StringBuilder("imageCapture0")
-               StringBuilder image = new StringBuilder("image0")
+               String id = "imageCaptureID0"
+               String label = "imageCapture"
+               String displayName = "imageCapturer"
+               String image = "image0"
 
                imageCaptureSensors.add(new ImageCapture(sendEvent, id, label, displayName, image))
        }
@@ -25,11 +25,4 @@ public class ImageCaptures extends SmartThings {
        def take(LinkedHashMap metaData) {
                take()
        }
-       
-       // Methods to return values
-       def getCurrentImage() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(imageCaptureSensors[0].getCurrentImage())
-               return tmpValues
-       }
 }
index e7328c569e6b89513b4139ce94705dc5e36e77e9..6a8e6d3065d6535e60b39f7402ec9f27977cf187 100755 (executable)
@@ -2,19 +2,14 @@
 package Location
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class LocationVar extends SmartThing {
-       // Features with numberical values
-       MutableInteger contactBookEnabled = new MutableInteger()
-       // Features with string values
-       StringBuilder mode = new StringBuilder()
-       StringBuilder locationMode = mode
-       StringBuilder name = new StringBuilder()
-       StringBuilder temperatureScale = new StringBuilder()
+       // id, label, and display name of the device
+       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>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
        // Other variables
        Phrase helloHome
        TimeZone timeZone
@@ -24,24 +19,20 @@ public class LocationVar extends SmartThing {
        List phoneNumbers
        
        LocationVar(Closure sendEvent, boolean init) {
-                       deviceValuesMap = deviceValueSmartThing
+                       deviceValueSmartThing = deviceValuesMap
+                       deviceIntValueSmartThing = deviceIntValuesMap
+                       idSmartThing = id
+                       labelSmartThing = label
+                       displayNameSmartThing = displayName
                        sendEventSmartThings = sendEvent
 
                        // Initialization
-                       StringBuilder sunset = new StringBuilder("sunset")
-                       StringBuilder sunsetTime = sunset
-                       StringBuilder sunrise = new StringBuilder("sunrise")
-                       StringBuilder sunriseTime = sunrise
-                       hubs = [[id:0, localIP:"128.195.204.105"]]
-                       modes = [[name: "home"],[name: "away"],[name: "night"]]
                        helloHome = new Phrase()
-                       contactBookEnabled.setValue(1)
                        contacts = ['AJ']
                        phoneNumbers = [9495379373]
-                       name.append("hub0")
-                       temperatureScale.append("F")
+                       modes = [[name: "home"],[name: "away"],[name: "night"]]
                        timeZone = TimeZone.getTimeZone("America/New_York")
-                       
+                       hubs = [[id:0, localIP:"128.195.204.105"]]
 
                        if (init)
                                mode.append("away")     
@@ -49,27 +40,12 @@ public class LocationVar extends SmartThing {
                                mode.append("home")
 
                        deviceValuesMap.put("mode", mode)
-                       deviceValuesMap.put("Location", mode)
+                       deviceValuesMap.put("name", "hub0")
+                       deviceValuesMap.put("temperatureScale", "F")
+                       deviceValuesMap.put("sunset", "sunset")
+                       deviceValuesMap.put("sunrise", "sunrise")
+                       deviceValuesMap.put("sunsetTime", "sunsetTime")
+                       deviceValuesMap.put("sunriseTime", "sunriseTime")
+                       deviceIntValuesMap.put("contactBookEnabled", 1)
        }
-
-       // Methods to return values
-       def getMode() {
-               return mode.toString()
-       }
-
-       def getLocationMode() {
-               return locationMode.toString()
-       }
-
-       def getName() {
-               return name.toString()
-       }
-
-       def getTemperatureScale() {
-               return temperatureScale.toString()
-       }
-
-       def getContactBookEnabled() {
-               return contactBookEnabled.getValue()
-       }
 }
index 1ceac32e84a3850693bbf0b25045d7430aef608e..50b96e45333667af85c1296b8b346f77411ec210 100644 (file)
@@ -4,17 +4,14 @@ import SmartThing.SmartThing
 
 public class Lock 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 currentLock = 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>()
 
-
-       Lock(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentLock) {
-               deviceValuesMap = deviceValueSmartThing
+       Lock(Closure sendEvent, String id, String label, String displayName, String currentLock) {
+               deviceValueSmartThing = deviceValuesMap 
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -24,14 +21,13 @@ public class Lock extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentLock = currentLock
 
                deviceValuesMap.put("lock", currentLock)
        }
 
        // Methods to set values
        def lock() {
-               action(currentLock, "locked")
+               action("locked", "lock")
        }
 
        def lock(LinkedHashMap metaData) {
@@ -39,26 +35,10 @@ public class Lock extends SmartThing {
        }
        
        def unlock() {
-               action(currentLock, "unlocked")
+               action("unlocked", "lock")
        }
 
        def unlock(LinkedHashMap metaData) {
                unlock()
        }
-
-       def action(StringBuilder variable, String newValue) {
-               if (!variable.toString().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.replace(0, variable.length(), newValue)
-                       println("Lock with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: "lock", value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentLock() {
-               return currentLock.toString()
-       }
-
 }
index 381bf2a44f4c1f4f9ccbb1d56d8dacffe2526adf..37deb0ac2a2b02dc62bfa3a008d0cf0042003ea3 100644 (file)
@@ -10,17 +10,17 @@ public class Locks extends SmartThings {
                locks = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("lockID0")
-               StringBuilder label = new StringBuilder("lock")
-               StringBuilder displayName = new StringBuilder("lock0")
-               StringBuilder lock = new StringBuilder()
+               String id = "lockID0"
+               String label = "lock"
+               String displayName = "lock"
+               String lock
 
                if (init)
-                       lock.append("locked")
+                       lock = "locked"
                else
-                       lock.append("unlocked")
+                       lock = "unlocked"
 
-               locks.add(new Lock(sendEvent,id, label, displayName, lock))
+               locks.add(new Lock(sendEvent, id, label, displayName, lock))
        }
 
        // Methods to set values
@@ -40,12 +40,5 @@ public class Locks extends SmartThings {
        def unlock(LinkedHashMap metaData) {
                unlock()
        }
-
-       // Methods to return values
-       def getCurrentLock() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(locks[0].getCurrentLock())
-               return tmpValues
-       }
 }
 
index 12433ab5d15e08fefea8e4fde9c44dd5c2f95849..ece6c86f58b646b8d30ed65a485a1f2b6fbced9f 100644 (file)
@@ -1,8 +1,6 @@
 /////////////////////////////////////////////////////////////////////
 def setLocationMode(String mode) {
        log.debug "DEBUG: setLocationMode is called. Current mode is: ${location_mode} and new mode is: ${mode}"
-       location.setValue([name: "Location", value: "$mode", deviceId: "locationID0", descriptionText: "",
-                          displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
        location.setValue([name: "mode", value: "$mode", deviceId: "locationID0", descriptionText: "",
                           displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
        location_mode = mode
index a387375c849ab7ff53354342977bf939ff4316c3..d77c88f60580917b2def0888ac39a1fa495eee1d 100644 (file)
@@ -8,7 +8,7 @@ def subscribe(Object obj, Closure FunctionToCall) {
                functionList.add(FunctionToCall)
        } else if (obj == location) {
                objectList.add(obj)
-               eventList.add("Location")
+               eventList.add("mode")
                 valueList.add("")
                functionList.add(FunctionToCall)
        }
@@ -18,11 +18,6 @@ def subscribe(Object obj, Closure FunctionToCall) {
 def subscribe(Object obj, String event, Closure FunctionToCall) {
     if (event == "tamper.tampered") {
        event = "contact"      //This really should be its own name
-    } else if ((event == "mode")||(event == "mode.away")||(event == "mode.home")||(event == "mode.night")) {
-       //This really should be fixed also...
-       event = "Location"
-    } else if (event == "unlocked") {
-      return
     }
     
     int dot = event.indexOf('.')
@@ -44,10 +39,6 @@ def subscribe(Object obj, String event, Closure FunctionToCall) {
 def subscribe(Object obj, String event, String FunctionToCall) {
     if (event == "tamper.tampered") {
        event = "contact"      //This really should be its own name
-    } else if ((event == "mode")||(event == "mode.away")||(event == "mode.home")||(event == "mode.night")) {
-       event = "Location"
-    } else if (event == "unlocked") {
-       return
     }
 
     int dot = event.indexOf('.')
index 7e6ff0a7f6a02d5d4b3c3f6fd61d31c6f2a92010..ddc1ba47a60dec0e8c5ef7b2e29158fff5cc9161 100644 (file)
@@ -4,16 +4,13 @@ import SmartThing.SmartThing
 
 public class MobilePresence 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 deviceNetworkId = 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>()
        
-
-       MobilePresence(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder deviceNetworkId) {
+       MobilePresence(Closure sendEvent, String id, String label, String displayName, String deviceNetworkId) {
                deviceValuesMap = deviceValueSmartThing
                idSmartThing = id
                labelSmartThing = label
@@ -24,13 +21,7 @@ public class MobilePresence extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.deviceNetworkId = deviceNetworkId
 
                deviceValuesMap.put("deviceNetworkId", deviceNetworkId)
        }
-
-       // Methods to return values
-       def getDeviceNetworkId() {
-               return deviceNetworkId.toString()
-       }
 }
index 2cea98823ab97b67113d7103299e29069fdcd819..d619868973fcb388f1656dc1288fafc2ca419e36 100644 (file)
@@ -10,18 +10,11 @@ public class MobilePresences extends SmartThings {
                mobilePresences = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("mobileDeviceID0")
-               StringBuilder label = new StringBuilder("mobileDevice")
-               StringBuilder displayName = new StringBuilder("mobileDevice0")
-               StringBuilder deviceNetworkId = new StringBuilder("mobile0")
+               String id = "mobileDeviceID0"
+               String label = "mobileDevice"
+               String displayName = "mobileDevice"
+               String deviceNetworkId
 
                mobilePresences.add(new MobilePresence(sendEvent, id, label, displayName, deviceNetworkId))
        }
-
-       // Methods to return values
-       def getDeviceNetworkId() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(mobilePresences[0].getDeviceNetworkId())
-               return tmpValues
-       }
 }
index f08ea0980443a00287848ca08e844a16e997182a..0a6c2ac330a9f062b810712c7deff2d5d7f4bf5c 100644 (file)
@@ -10,9 +10,9 @@ public class Momentaries extends SmartThings {
                momentaries = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("momentaryID0")
-               StringBuilder label = new StringBuilder("momentary")
-               StringBuilder displayName = new StringBuilder("momentary0")
+               String id = "momentaryID0"
+               String label = "momentary"
+               String displayName = "momentaryDevice"
 
                momentaries.add(new Momentary(sendEvent, id, label, displayName))
        }
index 4e72815d45f93348435de768f10c541e94cb99d5..27e49c2d08aa27b806a579c307121d940e5cd98d 100644 (file)
@@ -4,11 +4,11 @@ import SmartThing.SmartThing
 
 public class Momentary extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
+       String id
+       String label
+       String displayName
 
-       Momentary(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName) {
+       Momentary(Closure sendEvent, String id, String label, String displayName) {
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -22,8 +22,7 @@ public class Momentary extends SmartThing {
 
        // Methods to set values
        def push() {
-               println("the momentary switch with id:$id is pushed!")
-               sendEvent([name: "momentary", value: "pushed", deviceId: id, descriptionText: "",
-                          displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+               setValue([name: "momentary", value: "pushed", deviceId: id, descriptionText: "",
+                         displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
        }       
 }
index 85b5618f016275dba3cd8df56d9dff5fc02ae647..5cb2befd50c414142ab6338f8fe025912545eab9 100644 (file)
@@ -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<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
@@ -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()
-       }
 }
index 194fc3f1e0617ba844c5b45b13467fac862cef54..163849083b747b233606ab2f733ae11317e5e05e 100644 (file)
@@ -10,23 +10,16 @@ public class MotionSensors extends SmartThings {
                motionSensors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("motionSensorID0")
-               StringBuilder label = new StringBuilder("motion")
-               StringBuilder displayName = new StringBuilder("motionSensor0")
-               StringBuilder motion = new StringBuilder()
+               String id = "motionSensorID0"
+               String label = "motion"
+               String displayName = "motionSensor"
+               String motion
 
                if (init)
-                       motion.append("inactive")
+                       motion = "inactive"
                else
-                       motion.append("active")
+                       motion = "active"
 
                motionSensors.add(new MotionSensor(sendEvent, id, label, displayName, motion))
        }
-
-       // Methods to return values
-       def getCurrentMotion() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(motionSensors[0].getCurrentMotion())
-               return tmpValues
-       }
 }
index 481c0ac42b93c1e6506dc9f1df91a10989b8a4c7..425b3cab922500b309c45cf3f4d471fe8d5aecff 100644 (file)
@@ -2,31 +2,21 @@
 package MusicPlayer
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class MusicPlayer extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentLevel = new MutableInteger()
-       // Features with string values
-       StringBuilder currentMute = new StringBuilder()
-       StringBuilder currentStatus = new StringBuilder()
-       StringBuilder currentTrackData = new StringBuilder()
-       StringBuilder currentTrackDescription = new StringBuilder()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, StringBuilder> deviceValuesMap = new HashMap<String, StringBuilder>()
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
        // Possible values for eventsSince method
-       List<StringBuilder> possibleValues = new ArrayList<StringBuilder>();
+       List<String> possibleValues = new ArrayList<String>();
        
-       MusicPlayer(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentLevel, 
-                   StringBuilder currentMute, StringBuilder currentStatus, StringBuilder currentTrackData, StringBuilder currentTrackDescription) {
-               deviceValuesMap = deviceValueSmartThing
-               deviceIntValuesMap = deviceIntValueSmartThing
+       MusicPlayer(Closure sendEvent, String id, String label, String displayName, Integer currentLevel, 
+                   String currentMute, String currentStatus, String currentTrackData, String currentTrackDescription) {
+               deviceValueSmartThing = deviceValuesMap
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -37,15 +27,10 @@ public class MusicPlayer extends SmartThing {
                this.id = id
                this.label = label
                this.currentLevel = currentLevel
-               this.currentMute = currentMute
-               this.currentStatus = currentStatus
-               this.currentTrackData = currentTrackData
-               this.currentTrackDescription = currentTrackDescription
                possibleValues.add("on")
                possibleValues.add("off")
 
                deviceValuesMap.put("status", currentStatus)
-               deviceValuesMap.put("playpause", currentStatus)
                deviceValuesMap.put("trackDescription", currentTrackDescription)
                deviceValuesMap.put("mute", currentMute)
                deviceValuesMap.put("trackData", currentTrackData)
@@ -58,7 +43,7 @@ public class MusicPlayer extends SmartThing {
        }
 
        def on() {
-               action(currentStatus, "on", "status")
+               action("on", "status")
        }
 
        def off(LinkedHashMap metaData) {
@@ -66,7 +51,7 @@ public class MusicPlayer extends SmartThing {
        }
 
        def off() {
-               action(currentStatus, "off", "status")
+               action("off", "status")
        }
 
        def mute(LinkedHashMap metaData) {
@@ -74,7 +59,7 @@ public class MusicPlayer extends SmartThing {
        }
 
        def mute() {
-               action(currentMute, "muted", "mute")
+               action("muted", "mute")
        }
 
        def unmute(LinkedHashMap metaData) {
@@ -82,7 +67,7 @@ public class MusicPlayer extends SmartThing {
        }
 
        def unmute() {
-               action(currentMute, "unmuted", "mute")
+               action("unmuted", "mute")
        }
 
        def nextTrack(LinkedHashMap metaData) {
@@ -99,7 +84,7 @@ public class MusicPlayer extends SmartThing {
        }
 
        def pause() {
-               action(currentStatus, "pause", "status")
+               action("pause", "status")
        }
 
        def play(LinkedHashMap metaData) {
@@ -107,7 +92,7 @@ public class MusicPlayer extends SmartThing {
        }
 
        def play() {
-               action(currentStatus, "play", "status")
+               action("play", "status")
        }
 
        def playTrack(LinkedHashMap metaData) {
@@ -150,7 +135,7 @@ public class MusicPlayer extends SmartThing {
        }
 
        def setLevel(int level) {
-               action(currentLevel, level, "level")
+               action(level, "level")
        }
 
        def setTrack(LinkedHashMap metaData) {
@@ -167,54 +152,13 @@ public class MusicPlayer extends SmartThing {
        }
 
        def stop() {
-               action(currentStatus, "stop", "status")
-       }
-
-       def action(StringBuilder variable, String newValue, String feature) {
-               if (!variable.toString().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.replace(0, variable.length(), newValue)
-                       println("$feature of the music player with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       def action(MutableInteger variable, int newValue, String feature) {
-               if (!variable.getValue().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.setValue(newValue)
-                       println("$feature for the thermostat with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
+               action("stop", "status")
        }
 
        def musicChangeEvents() {
-               sendEvent([name: "trackDescription", value: "someDescriptions", deviceId: id.toString(), descriptionText: "",
+               setValue([name: "trackDescription", value: "someDescriptions", deviceId: id.toString(), descriptionText: "",
                           displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               sendEvent([name: "trackData", value: "someTrack", deviceId: id.toString(), descriptionText: "",
+               setValue([name: "trackData", value: "someTrack", deviceId: id.toString(), descriptionText: "",
                           displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
        }
-
-       // Methods to return values
-       def getCurrentLevel() {
-               return currentLevel.getValue()
-       }
-
-       def getCurrentMute() {
-               return currentMute.toString()
-       }
-       
-       def getCurrentStatus() {
-               return currentStatus.toString()
-       }
-
-       def getCurrentTrackData() {
-               return currentTrackData.toString()
-       }
-
-       def getCurrentTrackDescription() {
-               return currentTrackDescription.toString()
-       }
 }
index 0e88a88a01f3bbc788d44ae388b8f7f534063147..c10978eb2f6bce6b83691eb466fb19988eae35f1 100644 (file)
@@ -2,9 +2,6 @@
 package MusicPlayer
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class MusicPlayers extends SmartThings {
        List musicPlayers = new ArrayList()
        
@@ -13,27 +10,27 @@ public class MusicPlayers extends SmartThings {
                musicPlayers = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("musicPlayerID0")
-               StringBuilder label = new StringBuilder("status")
-               StringBuilder displayName = new StringBuilder("musicPlayer0")
-               StringBuilder mute = new StringBuilder()
-               StringBuilder status = new StringBuilder()
-               StringBuilder trackData = new StringBuilder()
-               StringBuilder trackDescription = new StringBuilder()
-               MutableInteger level = new MutableInteger()
+               String id = "musicPlayerID0"
+               String label = "status"
+               String displayName = "musicPlayer"
+               String mute
+               String status
+               String trackData
+               String trackDescription
+               Integer level
 
                if (init) {
-                       level.setValue(20)
-                       mute.append("unmuted")
-                       status.append("paused")
-                       trackData.append("someTrack")
-                       trackDescription.append("someDescriptions")
+                       level = 20
+                       mute = "unmuted"
+                       status = "paused"
+                       trackData = "someTrack"
+                       trackDescription = "someDescriptions"
                } else {
-                       level.setValue(30)
-                       mute.append("muted")
-                       status.append("play")
-                       trackData.append("someTrack")
-                       trackDescription.append("someDescriptions")
+                       level = 30
+                       mute = "muted"
+                       status = "play"
+                       trackData = "someTrack"
+                       trackDescription = "someDescriptions"
                }
 
                musicPlayers.add(new MusicPlayer(sendEvent, id, label, displayName, level, mute, status, trackData, trackDescription))
@@ -151,35 +148,4 @@ public class MusicPlayers extends SmartThings {
        def stop() {
                musicPlayers[0].stop()
        }
-
-       // Methods to return values
-       def getCurrentLevel() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(musicPlayers[0].getCurrentLevel())
-               return tmpValues
-       }
-
-       def getCurrentMute() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(musicPlayers[0].getCurrentMute())
-               return tmpValues
-       }
-       
-       def getCurrentStatus() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(musicPlayers[0].getCurrentStatus())
-               return tmpValues
-       }
-
-       def getCurrentTrackData() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(musicPlayers[0].getCurrentTrackData())
-               return tmpValues
-       }
-
-       def getCurrentTrackDescription() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(musicPlayers[0].getCurrentTrackDescription())
-               return tmpValues
-       }
 }
diff --git a/MutableInteger/MutableInteger.groovy b/MutableInteger/MutableInteger.groovy
deleted file mode 100644 (file)
index 4eeb0c0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Create a class for mutable integer
-package MutableInteger
-
-public class MutableInteger {
-       private int value;
-
-       public int getValue() {
-               return value;
-       }
-
-       public void setValue(int value) {
-               this.value = value;
-       }
-}
index 80ce59d66650bec55d312470c3cb7da5b4d4adbc..fe467e9cea117f31be22efd20bc7a995daf7270e 100644 (file)
@@ -4,9 +4,9 @@ import SmartThing.SmartThing
 
 public class NfcTouch extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
+       String id
+       String label
+       String displayName
 
        NfcTouch(Closure sendEvent) {
                idSmartThing = id
@@ -15,8 +15,8 @@ public class NfcTouch extends SmartThing {
                sendEventSmartThings = sendEvent
 
                // Initialization
-               id.append("nfcSensorID0")
-               label.append("nfcSensor")
-               displayName.append("nfcSensor0")
+               id = "nfcSensorID0"
+               label = "nfcSensor"
+               displayName = "nfcSensor"
        }
 }
index d960a3a1df8e4e3c5fc19f54dc469be5ec88552a..479e2b9b0b67e51d7f44bc4c0247fb9e98d3da82 100644 (file)
@@ -2,21 +2,16 @@
 package PowerMeter
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class PowerMeter extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentPower = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       PowerMeter(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentPower) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       PowerMeter(Closure sendEvent, String id, String label, String displayName, Integer currentPower) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,13 +21,7 @@ public class PowerMeter extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentPower = currentPower
 
                deviceIntValuesMap.put("power", currentPower)
        }
-
-       // Methods to return values
-       def getCurrentPower() {
-               return currentPower.getValue()
-       }
 }
index 330a4e3af6dd2053bb54e96fc80ef6cd4e92b4d5..e0600f6782e801d33fb586f2ecaabccae1f5b0ab 100644 (file)
@@ -2,9 +2,6 @@
 package PowerMeter
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class PowerMeters extends SmartThings {
        List powerMeters = new ArrayList()
 
@@ -13,23 +10,16 @@ public class PowerMeters extends SmartThings {
                powerMeters = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("powerMeterID0")
-               StringBuilder label = new StringBuilder("powerMeter")
-               StringBuilder displayName = new StringBuilder("powerMeter0")
-               MutableInteger power = new MutableInteger()
+               String id = "powerMeterID0"
+               String label = "powerMeter"
+               String displayName = "powerMeter"
+               Integer power
 
                if (init)
-                       power.setValue(50)
+                       power = 50
                else
-                       power.setValue(60)
+                       power = 60
 
                powerMeters.add(new PowerMeter(sendEvent, id, label, displayName, power))
        }
-
-       // Methods to return values
-       def getCurrentPower() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(powerMeters[0].getCurrentPower())
-               return tmpValues
-       }
 }
index 9c525293ed2551121642ae462ad21c3f03033f65..5ffc3fd9c7eebcb97dcf63588af8aa6ebcbc3bda 100644 (file)
@@ -4,17 +4,15 @@ import SmartThing.SmartThing
 
 public class PresenceSensor 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>()
        // Possible values for eventsSince method
-       List<StringBuilder> possibleValues = new ArrayList<StringBuilder>();
+       List<String> possibleValues = new ArrayList<String>();
 
-       PresenceSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentPresence) {
+       PresenceSensor(Closure sendEvent, String id, String label, String displayName, String currentPresence) {
                deviceValuesMap = deviceValueSmartThing
                idSmartThing = id
                labelSmartThing = label
@@ -26,15 +24,9 @@ public class PresenceSensor extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentPresence = currentPresence
                possibleValues.add("present")
                possibleValues.add("not present")
 
                deviceValuesMap.put("presence", currentPresence)
        }
-
-       // Methods to return values
-       def getCurrentPresence() {
-               return currentPresence.toString()
-       }
 }
index 942894aa2f9d9624aea5a5e89dfa48574cf0858e..3485eac83400dcc8c36983d9795f0ca9cf7f26d8 100644 (file)
@@ -9,23 +9,16 @@ public class PresenceSensors extends SmartThings {
                presenceSensors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("presenceSensorID0")
-               StringBuilder label = new StringBuilder("presence")
-               StringBuilder displayName = new StringBuilder("presenceSensor0")
-               StringBuilder presence = new StringBuilder()
+               String id = "presenceSensorID0"
+               String label = "presence"
+               String displayName = "presenceSensor"
+               String presence
 
                if (init)
-                       presence.append("not present")
+                       presence = "not present"
                else
-                       presence.append("present")
+                       presence = "present"
 
                presenceSensors.add(new PresenceSensor(sendEvent, id, label, displayName, presence))
        }
-
-       // Methods to return values
-       def getCurrentPresence() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(presenceSensors[0].getCurrentPresence())
-               return tmpValues
-       }
 }
index 8d7c4e06028571d75ba28150718f1c485e076595..9faad86be1cac222e099d3deff13ad7cbcb09c7a 100644 (file)
@@ -2,21 +2,16 @@
 package RelativeHumidityMeasurement
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class RelativeHumidityMeasurement extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentHumidity = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       RelativeHumidityMeasurement(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentHumidity) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       RelativeHumidityMeasurement(Closure sendEvent, String id, String label, String displayName, Integer currentHumidity) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,13 +21,7 @@ public class RelativeHumidityMeasurement extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentHumidity = currentHumidity
 
                deviceIntValuesMap.put("humidity", currentHumidity)
        }
-
-       // Methods to return values
-       def getCurrentHumidity() {
-               return currentHumidity.getValue()
-       }
 }
index 3e18c426efcd0dcadb31f0269234b230b725207c..084f7d98f74ae21eeb9e9a216c5b0557133da4da 100644 (file)
@@ -2,9 +2,6 @@
 package RelativeHumidityMeasurement
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class RelativeHumidityMeasurements extends SmartThings {
        List humidityMeasurements = new ArrayList()
        
@@ -13,23 +10,16 @@ public class RelativeHumidityMeasurements extends SmartThings {
                humidityMeasurements = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("humidityID0")
-               StringBuilder label = new StringBuilder("humidity")
-               StringBuilder displayName = new StringBuilder("humidity0")
-               MutableInteger humidity = new MutableInteger()
+               String id = "humidityID0"
+               String label = "humidity"
+               String displayName = "humiditySensor"
+               Integer humidity
 
                if (init)
-                       humidity.setValue(50)
+                       humidity = 50
                else
-                       humidity.setValue(60)
+                       humidity = 60
 
                humidityMeasurements.add(new RelativeHumidityMeasurement(sendEvent, id, label, displayName, humidity))
        }
-
-       // Methods to return values
-       def getCurrentHumidity() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(humidityMeasurements[0].getCurrentHumidity())
-               return tmpValues
-       }
 }
index 82fdc4ca340ff60a9ef9309ccdfbc5b6b07b505b..059ebaee3dc883da1401f35ed75d94a1b4cda537 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class RelaySwitch 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 currentSwitch = 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>()
 
-       RelaySwitch(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentSwitch) {
-               deviceValuesMap = deviceValueSmartThing
+       RelaySwitch(Closure sendEvent, String id, String label, String displayName, String currentSwitch) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,14 +21,13 @@ public class RelaySwitch extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentSwitch = currentSwitch
 
                deviceValuesMap.put("switch", currentSwitch)
        }
 
        // Methods to set values
        def on() {
-               action(currentSwitch, "on", "switch")
+               action("on", "switch")
        }
 
        def on(LinkedHashMap metaData) {
@@ -38,25 +35,10 @@ public class RelaySwitch extends SmartThing {
        }
 
        def off() {
-               action(currentSwitch, "off", "switch")
+               action("off", "switch")
        }
 
        def off(LinkedHashMap metaData) {
                off()
        }
-
-       def action(StringBuilder variable, String newValue, String feature) {
-               if (!variable.toString().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.replace(0, variable.length(), newValue)
-                       println("$feature of the relay switch with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentSwitch() {
-               return currentSwitch.toString()
-       }
 }
index 76420f37974338fdfa11f8592cdca6ab64fe8a50..bf89c2368a8ad4c54a194d11b96b8a444f371b92 100644 (file)
@@ -10,15 +10,15 @@ public class RelaySwitches extends SmartThings {
                relaySwitches = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("relaySwitchID0")
-               StringBuilder label = new StringBuilder("relaySwitch")
-               StringBuilder displayName = new StringBuilder("relaySwitch0")
-               StringBuilder currentSwitch = new StringBuilder()
+               String id = "relaySwitchID0"
+               String label = "switch"
+               String displayName = "relaySwitch"
+               String currentSwitch
 
                if (init)
-                       currentSwitch.append("off")
+                       currentSwitch = "off"
                else
-                       currentSwitch.append("on")
+                       currentSwitch = "on"
 
                relaySwitches.add(new RelaySwitch(sendEvent, id, label, displayName, currentSwitch))
        }
@@ -39,11 +39,4 @@ public class RelaySwitches extends SmartThings {
        def off(LinkedHashMap metaData) {
                off()
        }
-
-       // Methods to return values
-       def getCurrentSwitch() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(relaySwitches[0].getCurrentSwitch())
-               return tmpValues
-       }
 }
index a3da10b94531d42d45b33a23f513aceeba402946..4ae6f089956150156dc36602151a7b02351c7c0c 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class SleepSensor 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 currentSleeping = 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>()
 
-       SleepSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentSleeping) {
-               deviceValuesMap = deviceValueSmartThing
+       SleepSensor(Closure sendEvent, String id, String label, String displayName, String currentSleeping) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,13 +21,7 @@ public class SleepSensor extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentSleeping = currentSleeping
 
                deviceValuesMap.put("sleeping", currentSleeping)
        }
-
-       // Methods to return values
-       def getCurrentSleeping() {
-               return currentSleeping.toString()
-       }
 }
index 7f8eb12a2dbeef0b73edfbc9c4006b6cb61716a1..a9e28e0c5a91757b4671873cb03bff73759bd63b 100644 (file)
@@ -10,23 +10,16 @@ public class SleepSensors extends SmartThings {
                sleepSensors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("sleepSensorID0")
-               StringBuilder label = new StringBuilder("sleepSensor")
-               StringBuilder displayName = new StringBuilder("sleepSensor0")
-               StringBuilder sleeping = new StringBuilder()
+               String id = "sleepSensorID0"
+               String label = "sleeping"
+               String displayName = "sleepSensor"
+               String sleeping
 
                if (init)
-                       sleeping.append("sleeping")
+                       sleeping = "sleeping"
                else
-                       sleeping.append("not sleeping")
+                       sleeping = "not sleeping"
 
                sleepSensors.add(new SleepSensor(sendEvent, id, label, displayName, sleeping))
        }
-
-       // Methods to return values
-       def getCurrentSleeping() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(sleepSensors[0].getCurrentSleeping())
-               return tmpValues
-       }
 }
index a6907601d2edb3d0612daeaee6d012f45a6eac95..1f46551234af7f69b9a1f93c3d438d6cc046332a 100644 (file)
@@ -4,57 +4,45 @@ package SmartThing
 //JPF's Verify API
 import gov.nasa.jpf.vm.Verify
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
-public class SmartThing {      
-       List nonStoredDevices = ["aeonKeyFob", "appTouch", "button", "momentary", "nfcTouch"] // Devices with no stored value
-       List locationTimeFeatures = ["sunset", "sunrise", "sunriseTime", "sunsetTime"]
+public class SmartThing {
        def sendEventSmartThings
-
-       StringBuilder idSmartThing = new StringBuilder()
-       StringBuilder labelSmartThing = new StringBuilder()
-       StringBuilder displayNameSmartThing = new StringBuilder()
-       HashMap<String, StringBuilder> deviceValueSmartThing = new HashMap<String, StringBuilder>()
-       HashMap<String, MutableInteger> deviceIntValueSmartThing = new HashMap<String, MutableInteger>()
-       List<StringBuilder> possibleValuesSmartThings = new ArrayList<StringBuilder>();
+       String idSmartThing
+       String labelSmartThing
+       String displayNameSmartThing
+       HashMap<String, String> deviceValueSmartThing = new HashMap<String, String>()
+       HashMap<String, Integer> deviceIntValueSmartThing = new HashMap<String, Integer>()
+       List<String> possibleValuesSmartThings = new ArrayList<String>()
 
        // Method for handling events
-       def setValue(LinkedHashMap eventDataMap) {
-               def name = eventDataMap["name"]
-               def tmpID = eventDataMap["deviceId"]
-               def value = eventDataMap["value"]
+        def setValue(LinkedHashMap eventDataMap) {
+                def name = eventDataMap["name"]
+                def tmpID = eventDataMap["deviceId"]
+                def value = eventDataMap["value"]
 
-               if (deviceValueSmartThing.containsKey(name)) {
-                       StringBuilder tmpStr = deviceValueSmartThing.get(name)
-                       if (!value.equals(tmpStr.toString())) {
-                               tmpStr.replace(0, tmpStr.length(), value)
-                               println("the $name with id:$tmpID is triggered to $value!")
-                               sendEventSmartThings(eventDataMap)
-                       }
-               } else if (deviceIntValueSmartThing.containsKey(name)) {
-                       MutableInteger tmpInt = deviceIntValueSmartThing.get(name)
-                       if (!value.equals(tmpInt.getValue())) {
-                               tmpInt.setValue(value)
-                               println("the $name with id:$tmpID is triggered to $value!")
-                               sendEventSmartThings(eventDataMap)
-                       }
-               } else if (nonStoredDevices.contains(name)) {
-                       println("the $name with id:$tmpID is triggered to $value!")
-                       sendEventSmartThings(eventDataMap)
-               } else if (locationTimeFeatures.contains(name)) {
-                       return System.currentTimeMillis()
-                       println("This is $name!")
-                       sendEventSmartThings(eventDataMap)
-               }
-       }
+                if (deviceValueSmartThing.containsKey(name)) {
+                        if (!value.equals(deviceValueSmartThing.get(name))) {
+                                deviceValueSmartThing.put(name, value)
+                                println("the $name of the $displayNameSmartThing with id:$tmpID is triggered to $value!")
+                                sendEventSmartThings(eventDataMap)
+                        }
+                } else if (deviceIntValueSmartThing.containsKey(name)) {
+                        if (!value.equals(deviceIntValueSmartThing.get(name))) {
+                                deviceIntValueSmartThing.put(name, value)
+                                println("the $name of the $displayNameSmartThing with id:$tmpID is triggered to $value!")
+                                sendEventSmartThings(eventDataMap)
+                        }
+                } else {
+                        println("the $name of the $displayNameSmartThing with id:$tmpID is triggered to $value!")
+                        sendEventSmartThings(eventDataMap)
+                }
+        }
 
        def statesSince() {
                eventsSince()
        }
 
        def eventsSince() {
-               if (labelSmartThing.toString().equals("humidity") || labelSmartThing.toString().equals("temperature")) {
+               if (labelSmartThing.equals("humidity") || labelSmartThing.equals("temperature")) {
                        sendCurrentValue()
                } else {
                        sendPossibleValues()
@@ -62,8 +50,7 @@ public class SmartThing {
        }
 
        def sendCurrentValue() {
-               def label = labelSmartThing.toString()
-               def evtTemp = [[name: label, value: deviceIntValueSmartThing.get(label).getValue(), deviceId: idSmartThing.toString(), descriptionText: "",
+               def evtTemp = [[name: labelSmartThing, value: deviceIntValueSmartThing.get(labelSmartThing), deviceId: idSmartThing, descriptionText: "",
                                displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
                def init = Verify.getInt(0,1)
                def evtToSend = []
@@ -78,9 +65,9 @@ public class SmartThing {
        }
 
        def sendPossibleValues() {
-               def evtA = [[name: labelSmartThing.toString(), value: possibleValuesSmartThings[0].toString(), deviceId: idSmartThing.toString(), descriptionText: "",
+               def evtA = [[name: labelSmartThing, value: possibleValuesSmartThings[0], deviceId: idSmartThing, descriptionText: "",
                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
-               def evtB = [[name: labelSmartThing.toString(), value: possibleValuesSmartThings[1].toString(), deviceId: idSmartThing.toString(), descriptionText: "",
+               def evtB = [[name: labelSmartThing, value: possibleValuesSmartThings[1], deviceId: idSmartThing, descriptionText: "",
                                    displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
                def init = Verify.getInt(0,4)
                def evtToSend = []
@@ -115,7 +102,40 @@ public class SmartThing {
                }
        }
 
+       // Methods to set values
+       def action(String newValue, String feature) {
+               if (!deviceValueSmartThing.get(feature).equals(newValue)) {
+                       deviceValueSmartThing.put(feature, newValue)
+                       println("$feature of the $displayNameSmartThing with id:$idSmartThing is changed to $newValue!")
+                       sendEventSmartThings([name: feature, value: newValue, deviceId: idSmartThing, descriptionText: "",
+                                             displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+               }
+       }
+
+       def action(int newValue, String feature) {
+               if (!deviceIntValueSmartThing.get(feature).equals(newValue)) {
+                       deviceIntValueSmartThing.put(feature, newValue)
+                       println("$feature of the $displayNameSmartThing with id:$idSmartThing is changed to $newValue!")
+                       sendEventSmartThings([name: feature, value: newValue, deviceId: idSmartThing, descriptionText: "",
+                                             displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+               }
+       }
+
        // Methods to return values
+       def getProperty(String currentProperty) {
+               String property = currentProperty
+               if (property.contains("current")) // Check to see if we have currentXXX or xxx
+                       property = property.substring(7,8).toLowerCase()+property.substring(8);
+
+               if (deviceValueSmartThing.containsKey(property)) {
+                       return deviceValueSmartThing.get(property)
+               } else if (deviceIntValueSmartThing.containsKey(property)) {
+                       return deviceIntValueSmartThing.get(property)
+               } else {
+                       println("This capability does not support this property!")
+               }
+       }
+
        def currentState(String deviceFeature) {
                return [rawDateCreated: [time: System.currentTimeMillis()]]
        }
@@ -133,16 +153,4 @@ public class SmartThing {
        def latestValue(String deviceFeature) {
                currentValue(deviceFeature)
        }
-
-       def getId() {
-               return idSmartThing.toString()
-       }
-
-       def getLabel() {
-               return labelSmartThing.toString()
-       }
-       
-       def getDisplayName() {
-               return displayNameSmartThing.toString()
-       }
 }
index aa54b7e533c65c70d54570fa4a232d2594ee545f..4ac188d5b90c68fe962ecdd68a0232dd66219143 100644 (file)
@@ -1,9 +1,6 @@
 //Create a class for SmartThings
 package SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 class SmartThings {
        List smartThings = new ArrayList()
 
@@ -42,6 +39,12 @@ class SmartThings {
        }
 
        // Methods to return states of the devices
+       def getProperty(String currentProperty) {
+               List tmpValues = new ArrayList()
+               tmpValues.add(smartThings[0].getProperty(currentProperty))
+               return tmpValues
+       }
+
        def currentState(String deviceFeature) {
                List tmpValues = new ArrayList()
                tmpValues.add(smartThings[0].currentState(deviceFeature))
index 9eb9e8a28b613f2b8b854fb240f002e45be50941..b9ebeced6cde48e402b0f147a3e3d186ae5c8d71 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class SmokeDetector 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 currentSmoke = 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>()
 
-       SmokeDetector(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentSmoke) {
-               deviceValuesMap = deviceValueSmartThing
+       SmokeDetector(Closure sendEvent, String id, String label, String displayName, String currentSmoke) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,13 +21,7 @@ public class SmokeDetector extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentSmoke = currentSmoke
 
                deviceValuesMap.put("smoke", currentSmoke)
        }
-
-       // Methods to return values
-       def getCurrentSmoke() {
-               return currentSmoke.toString()
-       }
 }
index 0c790a63dca5aa39097ee074c099cb42194b8493..7bc455a076f3cd79bd699e38d6375a931e9dc043 100644 (file)
@@ -10,23 +10,16 @@ public class SmokeDetectors extends SmartThings {
                smokeDetectors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("smokeDetectorID0")
-               StringBuilder label = new StringBuilder("smokeDetector")
-               StringBuilder displayName = new StringBuilder("smokeDetector0")
-               StringBuilder smoke = new StringBuilder()
+               String id = "smokeDetectorID0"
+               String label = "smoke"
+               String displayName = "smokeDetector"
+               String smoke
 
                if (init)
-                       smoke.append("clear")
+                       smoke = "clear"
                else
-                       smoke.append("detected")
+                       smoke = "detected"
 
                smokeDetectors.add(new SmokeDetector(sendEvent, id, label, displayName, smoke))
        }
-
-       // Methods to return values
-       def getCurrentSmoke() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(smokeDetectors[0].getCurrentSmoke())
-               return tmpValues
-       }
 }
index da60b36591ad58150ee1b6d3b915838ae2cc2003..cd57d0ca8c086f51a3799830cb2590c3a2628ac4 100644 (file)
@@ -2,21 +2,16 @@
 package SpeechSynthesis
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class SpeechSynthesis extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentLevel = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       SpeechSynthesis(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentLevel) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       SpeechSynthesis(Closure sendEvent, String id, String label, String displayName, Integer currentLevel) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,27 +21,16 @@ public class SpeechSynthesis extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentLevel = currentLevel
 
                deviceIntValuesMap.put("level", currentLevel)
        }
 
        // Methods to set values
        def setLevel(int newValue) {
-               if (!currentLevel.getValue().equals(newValue)) {
-                       String tmpID = id.toString()
-                       currentLevel.setValue(newValue)
-                       println("The level of speech synthesis with id:$tmpID is changed to $currentLevel")
-               }
+               action(newValue, "level")
        }
 
        def speak(String message) {
-               String tmpID = id.toString()
-               println("Speech synthesis with id:$tmpID, SPEAKING:\"$message\"!")
-       }
-
-       // Methods to return values
-       def getCurrentLevel() {
-               return currentLevel.getValue()
+               println("Speech synthesis with id:$id, SPEAKING:\"$message\"!")
        }
 }
index 70237ed371ec360be3d0c6c0f90dcb0a1b277de4..2497ce6d73abb9b88117e21f8b54d56f65f220a7 100644 (file)
@@ -2,9 +2,6 @@
 package SpeechSynthesis
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class SpeechSynthesises extends SmartThings {
        List speechSynthesises = new ArrayList()
                
@@ -13,15 +10,15 @@ public class SpeechSynthesises extends SmartThings {
                speechSynthesises = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("speechSynthesisID0")
-               StringBuilder label = new StringBuilder("speechSynthesis")
-               StringBuilder displayName = new StringBuilder("speechSynthesis0")
-               MutableInteger level = new MutableInteger()
+               String id = "speechSynthesisID0"
+               String label = "level"
+               String displayName = "speechSynthesiser"
+               Integer level
 
                if (init)
-                       level.setValue(50)
+                       level = 50
                else
-                       level.setValue(60)
+                       level = 60
 
                speechSynthesises.add(new SpeechSynthesis(sendEvent, id, label, displayName, level))
        }
@@ -34,12 +31,4 @@ public class SpeechSynthesises extends SmartThings {
        def speak(String message) {
                speechSynthesises[0].speak(message)
        }
-
-       // Methods to return values
-       def getCurrentLevel() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(speechSynthesises[0].getCurrentLevel())
-               return tmpValues
-       }
-
 }
index 538fca576c92602e5ff63a660832a9f767049515..7f0faf357ff5b5d1f3fe31c56fd26ad77db37c3f 100644 (file)
@@ -2,22 +2,16 @@
 package StepSensor
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class StepSensor extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentGoal = new MutableInteger()
-       MutableInteger currentSteps = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       StepSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentSteps, MutableInteger currentGoal) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       StepSensor(Closure sendEvent, String id, String label, String displayName, Integer currentSteps, Integer currentGoal) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -27,19 +21,8 @@ public class StepSensor extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentSteps = currentSteps
-               this.currentGoal = currentGoal
 
                deviceIntValuesMap.put("steps", currentSteps)
                deviceIntValuesMap.put("goal", currentGoal)
        }
-
-       // Methods to return values
-       def getCurrentSteps() {
-               return currentSteps.getValue()
-       }
-
-       def getCurrentGoal() {
-               return currentGoal.getValue()
-       }
 }
index bbe8fd89257ce2775a040eed8854b32e70a0b278..067481f4fcbaba1ffae72819291ad01384175f52 100644 (file)
@@ -2,9 +2,6 @@
 package StepSensor
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class StepSensors extends SmartThings {
        List stepSensors = new ArrayList()
                
@@ -13,33 +10,20 @@ public class StepSensors extends SmartThings {
                stepSensors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("stepSensorID0")
-               StringBuilder label = new StringBuilder("stepSensor")
-               StringBuilder displayName = new StringBuilder("stepSensor0")
-               MutableInteger steps = new MutableInteger()
-               MutableInteger goal = new MutableInteger()
+               String id = "stepSensorID0"
+               String label = "steps"
+               String displayName = "stepSensor"
+               Integer steps
+               Integer goal
 
                if (init) {
-                       goal.setValue(50)
-                       steps.setValue(35)
+                       goal = 50
+                       steps = 35
                } else {
-                       goal.setValue(40)
-                       steps.setValue(60)
+                       goal = 40
+                       steps = 60
                }
 
                stepSensors.add(new StepSensor(sendEvent, id, label, displayName, steps, goal))
        }
-
-       // Methods to return values
-       def getCurrentSteps() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(stepSensors[0].getCurrentSteps())
-               return tmpValues
-       }
-
-       def getCurrentGoal() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(stepSensors[0].getCurrentGoal())
-               return tmpValues
-       }
 }
index b95bca122f2d69127e43079c8956e1eb38aabc75..d44846c9181ace4c04edba9c5e7ed243cfde3adb 100644 (file)
@@ -4,18 +4,16 @@ import SmartThing.SmartThing
 
 public class Switch 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 currentSwitch = 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>();
 
-       Switch(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentSwitch) {
-               deviceValuesMap = deviceValueSmartThing
+       Switch(Closure sendEvent, String id, String label, String displayName, String currentSwitch) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,7 +24,6 @@ public class Switch extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentSwitch = currentSwitch
                possibleValues.add("on")
                possibleValues.add("off")
 
@@ -35,7 +32,7 @@ public class Switch extends SmartThing {
 
        // Methods to set values
        def on() {
-               action(currentSwitch, "on", "switch")
+               action("on", "switch")
        }
 
        def on(LinkedHashMap metaData) {
@@ -43,25 +40,10 @@ public class Switch extends SmartThing {
        }
 
        def off() {
-               action(currentSwitch, "off", "switch")
+               action("off", "switch")
        }
 
        def off(LinkedHashMap metaData) {
                off()
        }
-
-       def action(StringBuilder variable, String newValue, String feature) {
-               if (!variable.toString().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.replace(0, variable.length(), newValue)
-                       println("$feature of the light with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentSwitch() {
-               return currentSwitch.toString()
-       }
 }
index a71a49f0b355ca75cefa29d333d57cabf50197d6..4729adf4e59840c404be776750c746f2915035b2 100644 (file)
@@ -9,15 +9,15 @@ public class Switches extends SmartThings {
                switches = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("switchID0")
-               StringBuilder label = new StringBuilder("switch")
-               StringBuilder displayName = new StringBuilder("switch0")
-               StringBuilder currentSwitch = new StringBuilder()
+               String id = "switchID0"
+               String label = "switch"
+               String displayName = "switch"
+               String currentSwitch
 
                if (init)
-                       currentSwitch.append("off")
+                       currentSwitch = "off"
                else
-                       currentSwitch.append("on")
+                       currentSwitch = "on"
 
                switches.add(new Switch(sendEvent, id, label, displayName, currentSwitch))
        }
@@ -38,11 +38,4 @@ public class Switches extends SmartThings {
        def off(LinkedHashMap metaData) {
                off()
        }
-
-       // Methods to return values
-       def getCurrentSwitch() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(switches[0].getCurrentSwitch())
-               return tmpValues
-       }
 }
index b4d09f7c9199e040e3788b7b21613974d616d331..0be1ee6598f61629eea4db82d45dc1f55706462c 100644 (file)
@@ -2,21 +2,16 @@
 package SwitchLevel
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class SwitchLevel extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentLevel = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
        
-       SwitchLevel(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentLevel) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       SwitchLevel(Closure sendEvent, String id, String label, String displayName, Integer currentLevel) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,7 +21,6 @@ public class SwitchLevel extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentLevel = currentLevel
 
                deviceIntValuesMap.put("level", currentLevel)
        }
@@ -41,17 +35,6 @@ public class SwitchLevel extends SmartThing {
        }
 
        def setLevel(int newValue) {
-               if (!currentLevel.getValue().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.setValue(newValue)
-                       println("the switch with id:$tmpID is setted to level $level!")
-                       sendEvent([name: "level", value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-       
-       // Methods to return values
-       def getCurrentLevel() {
-               return currentLevel.getValue()
+               action(newValue, "level")
        }
 }
index c48e1cf4bd64a1ce261555cdef53a8a8b7738f55..075fc44ca8c2da988330712da154f249f7533713 100644 (file)
@@ -2,9 +2,6 @@
 package SwitchLevel
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class SwitchLevels extends SmartThings {
        List switchLevels = new ArrayList()
 
@@ -13,15 +10,15 @@ public class SwitchLevels extends SmartThings {
                switchLevels = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("switchLevelID0")
-               StringBuilder label = new StringBuilder("switchLevel")
-               StringBuilder displayName = new StringBuilder("switchLevel0")
-               MutableInteger level = new MutableInteger()
+               String id = "switchLevelID0"
+               String label = "level"
+               String displayName = "switchLevel"
+               Integer level
 
                if (init)
-                       level.setValue(50)
+                       level = 50
                else
-                       level.setValue(60)
+                       level = 60
 
                switchLevels.add(new SwitchLevel(sendEvent, id, label, displayName, level))
        }
@@ -38,11 +35,4 @@ public class SwitchLevels extends SmartThings {
        def setLevel(int newValue) {
                switchLevels[0].setLevel(newValue)
        }
-
-       // Methods to return values
-       def getCurrentLevel() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(switchLevels[0].getCurrentLevel())
-               return tmpValues
-       }
 }
index 99afe6a3b117c3e5c616c48a7c97c0c70b0034ba..23933b59f102f0a974e9abac608809ce783cc3df 100644 (file)
@@ -2,21 +2,16 @@
 package TemperatureMeasurement
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class TemperatureMeasurement extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentTemperature = new MutableInteger()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       TemperatureMeasurement(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentTemperature) {
-               deviceIntValuesMap = deviceIntValueSmartThing
+       TemperatureMeasurement(Closure sendEvent, String id, String label, String displayName, Integer currentTemperature) {
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -26,14 +21,7 @@ public class TemperatureMeasurement extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentTemperature = currentTemperature
 
                deviceIntValuesMap.put("temperature", currentTemperature)
        }
-
-       // Methods to return values
-       def getCurrentTemperature() {
-               return currentTemperature.getValue()
-       }
-
 }
index a861cd2294aa72a60be3f870b35209656e0beb7e..5c942c1d487d0d8face2e1ffc4c93f1c4a96c633 100644 (file)
@@ -2,9 +2,6 @@
 package TemperatureMeasurement
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 public class TemperatureMeasurements extends SmartThings {
        List temperatureMeasurements = new ArrayList()
 
@@ -13,23 +10,16 @@ public class TemperatureMeasurements extends SmartThings {
                temperatureMeasurements = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("temperatureMeasurementID0")
-               StringBuilder label = new StringBuilder("temperature")
-               StringBuilder displayName = new StringBuilder("temperatureMeasurement0")
-               MutableInteger temperature = new MutableInteger()
+               String id = "temperatureMeasurementID0"
+               String label = "temperature"
+               String displayName = "temperatureMeasurement"
+               Integer temperature
 
                if (init)
-                       temperature.setValue(40)
+                       temperature = 40
                else
-                       temperature.setValue(60)
+                       temperature = 60
 
                temperatureMeasurements.add(new TemperatureMeasurement(sendEvent, id, label, displayName, temperature))
        }
-
-       // Methods to return values
-       def getCurrentTemperature() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(temperatureMeasurements[0].getCurrentTemperature())
-               return tmpValues
-       }
 }
index 4fa2c789ada95e7a6a85c0cc68769ced2e599aed..21c897f9a6e608d8a0ba4e06b46f65aef33cf162 100644 (file)
@@ -2,33 +2,20 @@
 package Thermostat
 import SmartThing.SmartThing
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 class Thermostat extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
-       // Features with numberical values
-       MutableInteger currentTemperature = new MutableInteger()
-       MutableInteger currentCoolingSetpoint = new MutableInteger()
-       MutableInteger currentHeatingSetpoint = new MutableInteger()
-       MutableInteger currentThermostatSetPoint = new MutableInteger()
-       // Features with string values
-       StringBuilder currentThermostatOperatingState = new StringBuilder()
-       StringBuilder currentThermostatFanMode = new StringBuilder()
-       StringBuilder currentThermostatMode = new StringBuilder()
-       StringBuilder currentClimateName = new StringBuilder()
+       String id
+       String label
+       String displayName
        // Maps from features to values
-       HashMap<String, StringBuilder> deviceValuesMap = new HashMap<String, StringBuilder>()
-       HashMap<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
-
-       Thermostat(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentTemperature, MutableInteger currentCoolingSetpoint, 
-                   MutableInteger currentHeatingSetpoint, MutableInteger currentThermostatSetPoint, StringBuilder currentThermostatOperatingState, StringBuilder currentThermostatFanMode, 
-                  StringBuilder currentThermostatMode, StringBuilder currentClimateName) {
-               deviceValuesMap = deviceValueSmartThing
-               deviceIntValuesMap = deviceIntValueSmartThing
+       HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
+
+       Thermostat(Closure sendEvent, String id, String label, String displayName, Integer currentTemperature, Integer currentCoolingSetpoint, 
+                   Integer currentHeatingSetpoint, Integer currentThermostatSetPoint, String currentThermostatOperatingState, String currentThermostatFanMode, 
+                  String currentThermostatMode, String currentClimateName) {
+               deviceValueSmartThing = deviceValuesMap
+               deviceIntValueSmartThing = deviceIntValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -38,27 +25,24 @@ class Thermostat extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentTemperature = currentTemperature
-               this.currentCoolingSetpoint = currentCoolingSetpoint
-               this.currentHeatingSetpoint = currentHeatingSetpoint
-               this.currentThermostatSetPoint = currentThermostatSetPoint
-               this.currentThermostatOperatingState = currentThermostatOperatingState
-               this.currentThermostatFanMode = currentThermostatFanMode
-               this.currentThermostatMode = currentThermostatMode
-               this.currentClimateName = currentClimateName
 
                deviceValuesMap.put("temperature", currentTemperature)
                deviceValuesMap.put("thermostatOperatingState", currentThermostatOperatingState)
                deviceValuesMap.put("thermostatFanMode", currentThermostatFanMode)
                deviceValuesMap.put("thermostatMode", currentThermostatMode)
+               deviceValuesMap.put("climateName", currentClimateName)
                deviceIntValuesMap.put("coolingSetpoint", currentCoolingSetpoint)
                deviceIntValuesMap.put("heatingSetpoint", currentHeatingSetpoint)
                deviceIntValuesMap.put("thermostatSetpoint", currentThermostatSetPoint)
        }
 
        // Methods to set values
+       def setThermostatSetpoint(int newValue) {
+               action(newValue, "thermostatSetpoint")
+       }
+
        def setCoolingSetpoint(int newValue) {
-               action(this.currentCoolingSetpoint, newValue, "coolingSetpoint")
+               action(newValue, "coolingSetpoint")
        }
 
        def setCoolingSetpoint(String newValue) {
@@ -66,7 +50,7 @@ class Thermostat extends SmartThing {
        }
 
        def setHeatingSetpoint(int newValue) {
-               action(this.currentHeatingSetpoint, newValue, "heatingSetpoint")
+               action(newValue, "heatingSetpoint")
        }
 
        def setHeatingSetpoint(String newValue) {
@@ -74,92 +58,43 @@ class Thermostat extends SmartThing {
        }
 
        def setThermostatFanMode(String newValue) {
-               action(this.currentThermostatFanMode, newValue, "thermostatFanMode")
+               action(newValue, "thermostatFanMode")
+       }
+
+       def setThermostatOperatingState(String newValue) {
+               action(newValue, "thermostatOperatingState")
        }
 
        def setThermostatMode(String newValue) {
-               action(this.currentThermostatMode, newValue, "thermostatMode")
+               action(newValue, "thermostatMode")
        }
 
        def cool() {
-               action(this.currentThermostatMode, "cool", "thermostatMode")
+               action("cool", "thermostatMode")
        }
 
        def heat() {
-               action(this.currentThermostatMode, "heat", "thermostatMode")
+               action("heat", "thermostatMode")
        }
 
        def auto() {
-               action(this.currentThermostatMode, "auto", "thermostatMode")
+               action("auto", "thermostatMode")
        }
        
        def emergencyHeat() {
-               action(this.currentThermostatMode, "emergencyHeat", "thermostatMode")
+               action("emergencyHeat", "thermostatMode")
        }
 
        def off() {
-               action(this.currentThermostatMode, "off", "thermostatMode")
+               action("off", "thermostatMode")
        }
 
        def setClimate(String info, String newValue) {
-               action(currentClimateName, newValue, "climateName")
+               action(newValue, "climateName")
        }
 
        def setHold(String info1, int coolingSetpoint, int heatingSetpoint, String info2, String info3) {
                setHeatingSetpoint(heatingSetpoint)
                setCoolingSetpoint(coolingSetpoint)
        }
-
-       def action(StringBuilder variable, String newValue, String feature) {
-               if (!variable.toString().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.replace(0, variable.length(), newValue)
-                       println("$feature of the thermostat with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       def action(MutableInteger variable, int newValue, String feature) {
-               if (!variable.getValue().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.setValue(newValue)
-                       println("$feature for the thermostat with id:$tmpID is changed to $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentTemperature() {
-               return currentTemperature.getValue()
-       }
-
-       def getCurrentCoolingSetpoint() {
-               return currentCoolingSetpoint.getValue()
-       }
-       
-       def getCurrentHeatingSetpoint() {
-               return currentHeatingSetpoint.getValue()
-       }
-
-       def getCurrentThermostatSetPoint() {
-               return currentThermostatSetPoint.getValue()
-       }
-
-       def getCurrentThermostatOperatingState() {
-               return currentThermostatOperatingState.toString()
-       }
-
-       def getCurrentThermostatFanMode() {
-               return currentThermostatFanMode.toString()
-       }
-
-       def getCurrentThermostatMode() {
-               return currentThermostatMode.toString()
-       }
-
-       def getCurrentClimateName() {
-               return currentClimateName.toString()
-       }
 }
index 693ba939f6c2096bf165af1e4981ef042e1c41eb..b2d59811ad6ddd828a7461e8f34d5fe653c29c72 100644 (file)
@@ -2,9 +2,6 @@
 package Thermostat
 import SmartThing.SmartThings
 
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
 class Thermostats extends SmartThings {
        List thermostats = new ArrayList()
 
@@ -13,34 +10,34 @@ class Thermostats extends SmartThings {
                thermostats = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("thermostatID0")
-               StringBuilder label = new StringBuilder("thermostat")
-               StringBuilder displayName = new StringBuilder("thermostat0")
-               StringBuilder climateName = new StringBuilder("climateName")
-               StringBuilder thermostatOperatingState = new StringBuilder()
-               StringBuilder thermostatFanMode = new StringBuilder()
-               StringBuilder thermostatMode = new StringBuilder()
-               MutableInteger temperature = new MutableInteger()
-               MutableInteger coolingSetpoint = new MutableInteger()
-               MutableInteger heatingSetpoint = new MutableInteger()
-               MutableInteger thermostatSetpoint = new MutableInteger()
+               String id = "thermostatID0"
+               String label = "thermostat"
+               String displayName = "thermostat"
+               String climateName "climateName"
+               String thermostatOperatingState
+               String thermostatFanMode
+               String thermostatMode
+               Integer temperature
+               Integer coolingSetpoint
+               Integer heatingSetpoint
+               Integer thermostatSetpoint
 
                if (init) {
-                       temperature.setValue(60)
-                       coolingSetpoint.setValue(70)
-                       heatingSetpoint.setValue(35)
-                       thermostatSetpoint.setValue(50)
-                       thermostatOperatingState.append("off")
-                       thermostatFanMode.append("off")
-                       thermostatMode.append("off")
+                       temperature = 60
+                       coolingSetpoint = 70
+                       heatingSetpoint = 35
+                       thermostatSetpoint = 50
+                       thermostatOperatingState = "off"
+                       thermostatFanMode = "off"
+                       thermostatMode = "off"
                } else {
-                       temperature.setValue(66)
-                       coolingSetpoint.setValue(80)
-                       heatingSetpoint.setValue(50)
-                       thermostatSetpoint.setValue(60)
-                       thermostatOperatingState.append("heating")
-                       thermostatFanMode.append("circulate")
-                       thermostatMode.append("auto")
+                       temperature = 66
+                       coolingSetpoint = 80
+                       heatingSetpoint = 50
+                       thermostatSetpoint = 60
+                       thermostatOperatingState = "heating"
+                       thermostatFanMode = "circulate"
+                       thermostatMode = "auto"
                }
 
                thermostats.add(new Thermostat(sendEvent, id, label, displayName, temperature, coolingSetpoint, 
@@ -49,6 +46,10 @@ class Thermostats extends SmartThings {
        }
 
        // Methods to set values
+       def setThermostatSetpoint(int thermostatSetpoint) {
+               thermostats[0].setThermostatSetpoint(thermostatSetpoint)
+       }
+
        def setCoolingSetpoint(int coolingSetpoint) {
                thermostats[0].setCoolingSetpoint(coolingSetpoint)
        }
@@ -73,6 +74,10 @@ class Thermostats extends SmartThings {
                thermostats[0].setThermostatMode(thermostatMode)
        }
 
+       def setThermostatOperatingState(String thermostatOperatingState) {
+               thermostats[0].setThermostatOperatingState(thermostatOperatingState)
+       }
+
        def setClimate(String info, String givenClimateName) {
                thermostats[0].setClimate(info, givenClimateName)
        }
@@ -101,53 +106,4 @@ class Thermostats extends SmartThings {
        def off() {
                thermostats[0].off()
        }
-
-       // Methods to return values
-       def getCurrentTemperature() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(thermostats[0].getCurrentTemperature())
-               return tmpValues
-       }
-
-       def getCurrentCoolingSetpoint() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(thermostats[0].getCurrentCoolingSetpoint())
-               return tmpValues
-       }
-       
-       def getCurrentHeatingSetpoint() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(thermostats[0].getCurrentHeatingSetpoint())
-               return tmpValues
-       }
-
-       def getCurrentThermostatSetPoint() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(thermostats[0].getCurrentThermostatSetPoint())
-               return tmpValues
-       }
-
-       def getCurrentThermostatOperatingState() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(thermostats[0].getCurrentThermostatOperatingState())
-               return tmpValues
-       }
-
-       def getCurrentThermostatFanMode() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(thermostats[0].getCurrentThermostatFanMode())
-               return tmpValues
-       }
-
-       def getCurrentThermostatMode() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(thermostats[0].getCurrentThermostatMode())
-               return tmpValues
-       }
-
-       def getCurrentClimateName() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(thermostats[0].getCurrentClimateName())
-               return tmpValues
-       }
 }
index a555d6892e9865ed131a5b702ec8fd3b9a97964b..dbd8eb95dea84a0077a585c962a6842fb666c84a 100644 (file)
@@ -3,15 +3,15 @@ package ThreeAxis
 
 public class ThreeAxis {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
+       String id
+       String label
+       String displayName
        // Other variables
        def sendEvent
        LinkedHashMap currentThreeAxis
        
 
-       ThreeAxis(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, LinkedHashMap currentThreeAxis) {
+       ThreeAxis(Closure sendEvent, String id, String label, String displayName, LinkedHashMap currentThreeAxis) {
                // Initialization
                this.id = id
                this.label = label
@@ -22,9 +22,8 @@ public class ThreeAxis {
 
        // Methods to set values
        def setValue(LinkedHashMap eventDataMap) {
-               def tmpID = id.toString()
                currentThreeAxis = new groovy.json.JsonSlurper().parseText(eventDataMap["value"])
-               println("the three axis with id:$tmpID of cube is chagned to $currentThreeAxis!")
+               println("the three axis with id:$id of cube is chagned to $currentThreeAxis!")
                sendEvent(eventDataMap)
        }
 
index b43854244fe765de395bbd9903f235cc6b3917b0..1ef1b3a1fdb0a0ac08087736964ca1a53e524abc 100644 (file)
@@ -10,9 +10,9 @@ public class ThreeAxises extends SmartThings {
                threeAxises = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("threeAxisID0")
-               StringBuilder label = new StringBuilder("threeAxis")
-               StringBuilder displayName = new StringBuilder("threeAxis0")
+               String id = "threeAxisID0"
+               String label = "threeAxis"
+               String displayName = "threeAxis"
                LinkedHashMap threeAxis
 
                if (init)
index 0cd43a9fe7b415725226e732dd755782de9fad17..91eef557b8bcb0084413c15b7a541a5011035ea2 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class Valve 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 currentValve = 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>()
 
-       Valve(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentValve) {
-               deviceValuesMap = deviceValueSmartThing
+       Valve(Closure sendEvent, String id, String label, String displayName, String currentValve) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,14 +21,13 @@ public class Valve extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentValve = currentValve
 
-               deviceValuesMap.put("valve", currentValve)
+               deviceValuesMap.put("contact", currentContact)
        }
 
        // Methods to set values
        def open() {
-               action(currentValve, "open", "contact")
+               action("open", "contact")
        }
 
        def open(LinkedHashMap metaData) {
@@ -38,25 +35,10 @@ public class Valve extends SmartThing {
        }
 
        def close() {
-               action(currentValve, "closed", "contact")
+               action("closed", "contact")
        }
 
        def close(LinkedHashMap metaData) {
                close()
        }
-       
-       def action(StringBuilder variable, String newValue, String feature) {
-               if (!variable.toString().equals(newValue)) {
-                       String tmpID = id.toString()
-                       variable.replace(0, variable.length(), newValue)
-                       println("$feature of the valve with id:$tmpID is $newValue!")
-                       sendEvent([name: feature, value: newValue, deviceId: tmpID, descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               }
-       }
-
-       // Methods to return values
-       def getCurrentValve() {
-               return currentValve.toString()
-       }
 }
index 3873ae9f6c69a329323acc4d342da1aad4099dae..051c28383fc24204c29423dba1fc4979b797f206 100644 (file)
@@ -10,15 +10,15 @@ public class Valves extends SmartThings {
                valves = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("valveID0")
-               StringBuilder label = new StringBuilder("valve")
-               StringBuilder displayName = new StringBuilder("valve0")
-               StringBuilder valve = new StringBuilder()
+               String id = "valveID0"
+               String label = "contact"
+               String displayName = "valveSensor"
+               String valve
                
                if (init)
-                       valve.append("closed")
+                       valve = "closed"
                else
-                       valve.append("open")
+                       valve = "open"
 
                valves.add(new Valve(sendEvent, id, label, displayName, valve))
        }
@@ -39,12 +39,4 @@ public class Valves extends SmartThings {
        def close(LinkedHashMap metaData) {
                close()
        }
-
-       // Methods to return values
-       def getCurrentValve() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(valves[0].getCurrentValve())
-               return tmpValues
-       }
-
 }
index 8c4e921fccaf4d4baaca2e46796b145e9a7ddcec..b4369cd484f42edbb1e54d1d589965784df0fcb2 100644 (file)
@@ -4,16 +4,14 @@ import SmartThing.SmartThing
 
 public class WaterSensor 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 currentWater = 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>()
 
-       WaterSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentWater) {
-               deviceValuesMap = deviceValueSmartThing
+       WaterSensor(Closure sendEvent, String id, String label, String displayName, String currentWater) {
+               deviceValueSmartThing = deviceValuesMap
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
@@ -23,13 +21,7 @@ public class WaterSensor extends SmartThing {
                this.id = id
                this.label = label
                this.displayName = displayName
-               this.currentWater = currentWater
 
                deviceValuesMap.put("water", currentWater)
        }
-
-       // Methods to return values
-       def getCurrentWater() {
-               return currentWater.toString()
-       }
 }
index 4813e03d0841d6b26c33b21a21f5bc026616dd3c..adf0df9a3d25ae8b0baec2fbb589e315a9d1b29a 100644 (file)
@@ -4,29 +4,22 @@ import SmartThing.SmartThings
 
 public class WaterSensors extends SmartThings {
        List waterSensors = new ArrayList()
-               
+
        WaterSensors(Closure sendEvent, boolean init) {
                // Only initialize one time since we only have one device for each capability
                waterSensors = smartThings
 
                // Initialization
-               StringBuilder id = new StringBuilder("waterSensorID0")
-               StringBuilder label = new StringBuilder("waterSensor")
-               StringBuilder displayName = new StringBuilder("waterSensor0")
-               StringBuilder water = new StringBuilder()
+               String id = "waterSensorID0"
+               String label = "water"
+               String displayName = "waterSensor"
+               String water
 
                if (init)
-                       water.append("dry")
+                       water = "dry"
                else
-                       water.append("wet")
+                       water = "wet"
 
                waterSensors.add(new WaterSensor(sendEvent, id, label, displayName, water))
        }
-               
-       // Methods to return values
-       def getCurrentWater() {
-               List tmpValues = new ArrayList()
-               tmpValues.add(waterSensors[0].getCurrentWater())
-               return tmpValues
-       }
 }
index 980a05a10608784634a7e77c244721d9a7df57a4..0cc6851e5cb2a57e082b6fff4808191d8bfd9c23 100644 (file)
@@ -4,19 +4,18 @@ import SmartThing.SmartThing
 
 public class Touched extends SmartThing {
        // id, label, and display name of the device
-       StringBuilder id = new StringBuilder()
-       StringBuilder label = new StringBuilder()
-       StringBuilder displayName = new StringBuilder()
+       String id
+       String label
+       String displayName
 
        Touched(Closure sendEvent) {
+               id = "appTouchID0"
+               label = "appTouch"
+               displayName = "appTouchSensor"
+               
                idSmartThing = id
                labelSmartThing = label
                displayNameSmartThing = displayName
                sendEventSmartThings = sendEvent
-
-               // Initialization
-               id.append("appTouchID0")
-               label.append("appTouch")
-               displayName.append("appTouch0")
        }
 }
index 8220ad4b063f71cc94862ab348062f3b84301c3f..a9147cda7b216537e4555e71846a20da8bde0e2b 100644 (file)
@@ -1,2 +1,2 @@
-                       doorControlObject[0].setValue([name: "doorState", value: "closed", deviceId: "doorControlID0", descriptionText: "",
+                       doorControlObject[0].setValue([name: "door", value: "closed", deviceId: "doorControlID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index 35bd04e680d46d15264ccb61c2c6f2c084b06d5d..6d228cbf385a74df8804b5ad8ac3fc4b81c4f4a9 100644 (file)
@@ -1,2 +1,2 @@
-                       doorControlObject[0].setValue([name: "doorState", value: "open", deviceId: "doorControlID0", descriptionText: "",
+                       doorControlObject[0].setValue([name: "door", value: "open", deviceId: "doorControlID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index b935c204361ed4597c55211520d4a014b0535e51..981232d18798d99a9eb2aef1736a7051db9d16f5 100644 (file)
@@ -1,2 +1,2 @@
-                       locationObject.setValue([name: "Location", value: "away", deviceId: "locationID0", descriptionText: "",
+                       locationObject.setValue([name: "mode", value: "away", deviceId: "locationID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index c28caa5c9771f7b0dad837c1e4797797cdbe2f69..6791eec9a47b3248ea159417458a0648e693568f 100644 (file)
@@ -1,2 +1,2 @@
-                       locationObject.setValue([name: "Location", value: "home", deviceId: "locationID0", descriptionText: "",
+                       locationObject.setValue([name: "mode", value: "home", deviceId: "locationID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index 5f088d3d9303d0636a654ec4deda366b3f7fab65..34c4781adef2952076051aab0aa5133ebcf75a0f 100644 (file)
@@ -1,2 +1,2 @@
-                       locationObject.setValue([name: "Location", value: "night", deviceId: "locationID0", descriptionText: "",
+                       locationObject.setValue([name: "mode", value: "night", deviceId: "locationID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index 6791eec9a47b3248ea159417458a0648e693568f..1dbd8a81d927ae2663a540d97ea923c35d64d223 100644 (file)
@@ -1,2 +1,2 @@
                        locationObject.setValue([name: "mode", value: "home", deviceId: "locationID0", descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
index 869ed7e14098279b8bff31256a4cd86c97c3cea1..543642535c189e4c4c4934bc1f2a109186e7d1c0 100644 (file)
@@ -1,2 +1,2 @@
-                       motionSensorObjectp[0].setValue([name: "motion", value: "active", deviceId: "motionSensorID0", descriptionText: "",
+                       motionSensorObject[0].setValue([name: "motion", value: "active", deviceId: "motionSensorID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index 1409566e8f54f08bb5285490e14187a4c5d4f4c4..b8eef4b60e68211580edb39491523a2e7529186d 100644 (file)
@@ -1,2 +1,2 @@
-                       touchSensorObject.setValue([name: "nfcTouch", value: "touched", deviceId: "nfcSensorID0", descriptionText: "",
+                       touchSensorObject[0].setValue([name: "nfcTouch", value: "touched", deviceId: "nfcSensorID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index ec7e7ff209e60b4c08ddf02c5d4b420343c429a7..803ed21fea033a30747566724a9a0eb001aa489b 100644 (file)
@@ -1,2 +1,2 @@
-                       lockObject[0].setValue([name: "unlock", value: "unlocked ", deviceId: "lockID0", descriptionText: "",
+                       lockObject[0].setValue([name: "lock.unlocked", value: "unlocked", deviceId: "lockID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])