1 //Create a class for illuminance measurement
2 package IlluminanceMeasurement
3 import SmartThing.SmartThings
5 //Importing mutable integer class
6 import MutableInteger.MutableInteger
8 public class IlluminanceMeasurements extends SmartThings {
9 List illuminanceMeasurements = new ArrayList()
11 IlluminanceMeasurements(Closure sendEvent, boolean init) {
12 // Only initialize one time since we only have one device for each capability
13 illuminanceMeasurements = smartThings
16 StringBuilder id = new StringBuilder("illuminanceID0")
17 StringBuilder label = new StringBuilder("illuminance")
18 StringBuilder displayName = new StringBuilder("illuminance0")
19 MutableInteger illuminance = new MutableInteger()
22 illuminance.setValue(20000)
24 illuminance.setValue(5)
26 illuminanceMeasurements.add(new IlluminanceMeasurement(sendEvent, id, label, displayName, illuminance))
29 // Methods to return values
30 def getCurrentIlluminance() {
31 List tmpValues = new ArrayList()
32 tmpValues.add(illuminanceMeasurements[0].getCurrentIlluminance())