miio-controller

1.0.0 • Public • Published

miIO protocol controller

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.

Usage

const miIO = require('miio-controller');

Example

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));

Example with async await

async function main() {
    let miio = new miIO("tokenHere", "ipHere");
    await miio.handshake();
    console.log(await miio.sendCommand('get_prop', ["power"]));
}
main();

More methods

  • sendJson(json) - send custom json string to device.

Package Sidebar

Install

npm i miio-controller

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

11.2 kB

Total Files

7

Last publish

Collaborators

  • mafof