cap:voltage
- read voltage of something¶
This capability is used to mark sensors that report the voltage of something.
if(thing.matches('cap:voltage')) {
const voltage = await thing.voltage();
console.log('Voltage:', voltage.volts);
}
API¶
Events¶
Protected methods¶
Implementing capability¶
Implementors of this capability should call updateRelativeHumidity
whenever
the relative humidity changes.
const { Sensor, Voltage } = require('abstract-things/sensors');
class Example extends Sensor.with(Voltage) {
constructor() {
super();
this.updateVoltage(230);
}
}