This is plugin developed by based on plugin miIO Device Library It's plugin provides simple work above protocol miIO, is provided simple API for send and recieve commands different device's. Have support async methods.
const miIO = require('miio-controller');
let miio = new miIO("tokenHere", "ipHere");
miio.handshake()
.then(() => {
miio.sendCommand('get_prop', ["power"])
.then(res => console.log(res))
.catch(err => console.log(err));
})
.catch(err => console.log(err));
async function main() {
let miio = new miIO("tokenHere", "ipHere");
await miio.handshake();
console.log(await miio.sendCommand('get_prop', ["power"]));
}
main();
- sendJson(json) - send custom json string to device.