cap:carbon-dioxide-level
- read carbon dioxide level¶
This capability is used to mark sensors that report their carbon dioxide level as PPM (parts per million). The value is reported as a number.
if(thing.matches('cap:carbon-dioxide-level')) {
console.log('Carbon dioxide:', await thing.carbonDioxideLevel());
thing.on('carbonDioxideLevelChanged', v => console.log('Changed to:', v));
}
API¶
Events¶
Protected methods¶
Implementing capability¶
Implementors of this capability should call updateCarbonDioxideLevel
whenever the PPM of carbon dioxide changes.
const { Sensor, CarbonDioxideLevel } = require('abstract-things/sensors');
class Example extends Sensor.with(CarbonDioxideLevel) {
constructor() {
super();
this.updateCarbonDioxideLevel(390);
}
}