Skip to content

Latest commit

 

History

History
82 lines (51 loc) · 1.63 KB

illuminance.rst

File metadata and controls

82 lines (51 loc) · 1.63 KB

cap:illuminance - read illuminance

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());

}

API

Events

Protected methods

Implementing capability

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);

}

}