type:power-outlet
- Power outlets¶
Things marked with power-outlet
represent a single outlet that can take a
single plug. Outlets can be both stand-alone and children of another thing,
such as a power strip or wall outlet.
The power and switchable-power capability is commonly used with outlets to switch the power of the outlet. Outlets can also be sensors if they report power load or power consumption.
if(thing.matches('type:power-outlet')) {
// This is a power outlet
if(thing.matches('cap:switchable-power')) {
// And it also supports power switching
thing.turnOn()
.then(...)
.catch(...);
}
}
Implementing type¶
const { PowerOutlet } = require('abstract-things/electrical');
class Example extends PowerOutlet.with(...) {
}