JSPM

  • Created
  • Published
  • Downloads 111
  • Score
    100M100P100Q82732F
  • License MIT

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more

Package Exports

  • node-mihome

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-mihome) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

MiHome Device Library

Control MiHome devices via local network or cloud.

Devices models

It have many models of device, each devices have many properties and method, you can find all in ./devices folder.

Installation

npm install miio

Usage

const mihome = require('mihome');

Login Mijia account to use cloud protocol. It's optional but some devices aren't supported local protocol so you need login to control that devices.

const username = 'email@example.com';
const password = 'password';
await mihome.miCloudProtocol.login(username, password);
await mihome.miCloudProtocol.getDevices(); // return all devices from your acount with all information to create device in the next step
await mihome.miCloudProtocol.getDevices([deviceId1, deviceId2, ...]); // get devies information from list ids

Create device:

const device = mihome.device({
  id: '100000', // device id
  address: '192.168.31.13', // local ip address
  model: 'zhimi.aircondition.v1', // device model
  token: 'abcdefgfabcdefgfabcdefgfabcdefgf', // device token
  protocol: 'local|cloud', // optional
  parent: '1234abcd' // gateway SID for aqara-protocol device
  refresh: 30000 // interval refresh device properties in ms
});
device.on('properties', (data) => {
  console.log(properties);
});
await device.init(); // start connect and interval load properties
device.destroy();

List properties and methods of device can be found at ./devices folder

Todos list

Reporting issues or need more devices

I only have a litte devices in Mi Ecosystem, so wellcome for all issues or new device request.

Buy me a coffee

BTC: 1E9k2s3swbTwPRgHqjNHmxkWF8hf7uN2sc

ETH: 0x25b744eeb2a979f39e8375c8c9fac6db750438b1

Paypal: https://paypal.me/maxinminax