cap:power-load
- read the current power load¶
This capability is used to mark sensors that report power load, that is the power currently being used.
if(thing.matches('cap:power-load')) {
const powerLoad = await thing.powerLoad();
console.log('Power load:', powerLoad.watts);
}
API¶
Events¶
Protected methods¶
Implementing capability¶
Implementors of this capability should call updatePowerLoad
whenever
the power load changes.
const { Sensor, PowerLoad } = require('abstract-things/sensors');
class Example extends Sensor.with(PowerLoad) {
constructor() {
super();
this.updatePowerLoad(10);
}
}