1 //Create a class for illuminance measurement
2 package IlluminanceMeasurement
3 import SmartThing.SmartThings
5 public class IlluminanceMeasurements extends SmartThings {
6 List illuminanceMeasurements = new ArrayList()
8 IlluminanceMeasurements(Closure sendEvent, boolean init) {
9 // Only initialize one time since we only have one device for each capability
10 illuminanceMeasurements = smartThings
13 StringBuilder id = new StringBuilder("illuminanceID0")
14 StringBuilder label = new StringBuilder("illuminance")
15 StringBuilder displayName = new StringBuilder("illuminance0")
16 MutableInteger illuminance = new MutableInteger()
19 illuminance.setValue(20000)
21 illuminance.setValue(5)
23 illuminanceMeasurements.add(new IlluminanceMeasurement(sendEvent, id, label, displayName, illuminance))
26 // Methods to return values
27 def getCurrentIlluminance() {
28 List tmpValues = new ArrayList()
29 tmpValues.add(illuminanceMeasurements[0].getCurrentIlluminance())