aholstenson / miio

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
MIT License
1.86k stars 354 forks source link

Support for Roborock S6 MaxV? #293

Open benjhess opened 4 years ago

benjhess commented 4 years ago

Device type is currently unknown:

$ miio discover
 INFO  Discovering devices. Press Ctrl+C to stop.

Device ID: ---MY-ID---
Model info: Unknown
Address: xxx.xxx.xxx.xxx
Token: ???
Support: Unknown

... therefore clean cmd does not work:

code:

const device = await miio.device({address, token});
const isVac = device.matches('type:vacuum');
console.log('is vac:', isVac);
await device.clean();

output:

is vac: false
TypeError: device.clean is not a function

Is there any way to hint the device type to miio and use the clean function?

benjhess commented 4 years ago

The problem is the missing device mapping in miio/lib/models.js:

...
'roborock.vacuum.a10': Vacuum,
...
benjhess commented 4 years ago

Seems like the maintainer of this repo is no longer maintaining it. Most active development is now found in: https://github.com/homebridge-xiaomi-roborock-vacuum/homebridge-xiaomi-roborock-vacuum

Also includes support for S6 MaxV...

benjhess commented 4 years ago

New lib can also clean rooms. Usage is not documented, as miio fork is only used in homebridge plugin:

const address = '...your vac lan ip here';
const token = '...your token here';
const device = await miio.device({address, token});
const roomMap = await device.getRoomMap();
const roomIds = roomMap.map(c => c[0]);
const firstRoomId = roomIds.shift();
await device.cleanRooms([firstRoomId]);
await device.destroy();

BTW: Device token can be obtained by using com.xiaomi.smarthome-5.4.49.apk. Token is found in Log file under "SmartHome/logs/plug_DeviceManager/*.txt" on your android device...