node-miio
Version:
Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
81 lines (60 loc) • 1.27 kB
Markdown
* **Devices**: Mi Robot Vacuum
* **Model identifiers**: `rockrobo.vacuum.v1`
Robot vacuums are mapped into a device of type [`vacuum`][vacuum]. The device
will support many different capabilities, such as autonomous cleaning, getting
the cleaning state and more.
```javascript
if(device.matches('type:vacuum')) {
/*
* This device is a vacuum.
*/
}
```
```javascript
// Get the current cleaning state
device.cleaning()
.then(isCleaning => ...)
.catch(...);
// With async/wait
const isCleaning = await device.cleaning();
```
```javascript
// Request cleaning
device.clean()
.then(...)
.catch(...);
// With async/await
await device.clean();
```
```javascript
// Stop cleaning
device.stop()
.then(...)
.catch(...);
// With async/await
await device.stop();
```
```javascript
// Spot clean
device.spotClean()
.then(...)
.catch(...);
// With async/await
await device.spotClean();
```
```javascript
// Get the battery level
device.batteryLevel()
.then(level => ...)
.catch(...);
// With async/wait
const level = await device.batteryLevel();
```