miio
Version:
Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
63 lines (43 loc) • 1.6 kB
Markdown
Aqara Light Control (Wall Switch)
* **Model identifiers**: `lumi.ctrl_neutral1`, `lumi.ctrl_neutral2`, `lumi.ctrl_ln1`, `lumi.ctrl_ln2`
The supported models of power strips are mapped into a [`wall-switch`][wall-switch] where individual channels are available as child devices. The
child devices are [lights][light] with support for
[power switching][switchable-power].
## Examples
### Check if device is a wall switch
```javascript
if(device.matches('type:wall-switch')) {
/*
* This device is a wall switch.
*/
}
```
```javascript
const light0 = device.child('0');
// For some devices
const light1 = device.child('1');
```
```javascript
const light0 = device.child('0');
// Change power to on
light0.power(true)
.then(...)
.catch(...);
// With async/await
await light0.power(true);
```
* `device.
* `device.power()` - get if the air purifier is currently active
* `device.power(boolean)` - switch the air purifier on, returns a promise
* `device.setPower(boolean)` - change the power state of the device, returns a promise
* `device.on(power, isOn => ...)` - listen for power changes
[ ]: http://abstract-things.readthedocs.io/en/latest/electrical/wall-switches.html
[ ]: http://abstract-things.readthedocs.io/en/latest/common/power.html
[ ]: http://abstract-things.readthedocs.io/en/latest/common/switchable-power.html
* **Devices**: