type:power-channel
- Power channels¶
Things marked with power-channel
represent a single channel of power.
Power channels are usually virtual, such as individual power lines in a
power switch.
The power and switchable-power capability is commonly used with channels to support switch the power. Channels can also be sensors if they report power load or power consumption.
if(thing.matches('type:power-channel')) {
// This is a power channel
if(thing.matches('cap:switchable-power')) {
// And it also supports power switching
thing.turnOn()
.then(...)
.catch(...);
}
}
Implementing type¶
const { PowerChannel } = require('abstract-things/electrical');
class Example extends PowerChannel.with(...) {
}