cap:pm10 - read PM10 density (air quality)

This capability is used to mark sensors that monitor particulate matter (PM) between 2.5 and 10 micrometers (μm).

if(thing.matches('cap:pm10')) {
        console.log('PM10:', await thing.pm10());
}

API

pm10()

Get the current PM10 as micrograms per cubic meter (μg/m³).

Returns:The current value as micrograms per cubic meter (μg/m³). Value is a number.

Example:

console.log('PM10:', await thing.pm10());

Events

pm10Changed

The PM10 has changed. Payload is a number with the new PM10 as micrograms per cubic meter (μg/m³).

Example:

thing.on('pm10Changed', v => console.log('Changed to:', v));

Protected methods

updatePM10(value)

Update the current PM10 as micrograms per cubic meter (μg/m³). Should be called whenever a change is detected.

Arguments:
  • value – The new PM10 value. Will be converted to a number.

Example:

this.updatePM10(5);

Implementing capability

Implementors of this capability should call updatePM10 whenever the detected PM10 changes.

const { Sensor, PM10 } = require('abstract-things/sensors');

class Example extends Sensor.with(PM10) {

        constructor() {
                super();

                this.updatePM10(5);
        }

}