- Devices: Mi Smart Power Strip
- Model identifiers:
qmi.powerstrip.v1,zimi.powerstrip.v2
The two supported models of power strips are mapped into a power-strip with support for power switching.
if(device.matches('type:power-strip')) {
/*
* This device is a power strip.
*/
}// Get if the outlets on the strip have power
device.power()
.then(isOn => console.log('Outlet power:', isOn))
.catch(...);
// Using async/await
console.log('Outlet power:', await device.power());// Switch the outlets on
device.setPower(true)
.then(...)
.catch(...)
// Switch on via async/await
await device.power(true);Power - cap:power and cap:switchable-power
device.power()- get if the outlets currently have powerdevice.power(boolean)- switch if outlets have powerdevice.setPower(boolean)- switch if outlets have powerdevice.on(power, isOn => ...)- listen for power changes
Mode - cap:mode and cap:switchable-mode
Power strips may support setting a certain mode, such as a special green mode.
device.mode()- get the current modedevice.mode(string)- set the current mode of the device, returns a promisedevice.setMode(string)- set the current mode of the device, returns a promisedevice.modes()- read-only array indicating the modes supports by the devicedevice.on('modeChanged', mode => ...)- listen for changes to the current mode
The modes supported change between different models, but most devices support:
green, green modenormal, normal mode