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
- }
}