This capability is used to mark sensors that report illuminance </values/illuminance>
. This is commonly used for sensors that read light levels.
js
- if(thing.matches('cap:illuminance')) {
console.log('Light level:', await thing.illuminance());
}
Implementors of this capability should call updateIlluminance
whenever the detected light level changes.
js
const { Sensor, Illuminance } = require('abstract-things/sensors');
class Example extends Sensor.with(Illuminance) {
- constructor() {
super();
this.updateIlluminance(10);
}
}