mi-service-lite
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

MiService

XiaoMi Cloud Service for mi.com

⚡️ Installation

npm install mi-service-lite

# or
yarn add mi-service-lite

# or
pnpm install mi-service-lite

🔥 Usage

import { getMiIOT, getMiNA } from "mi-service-lite";

async function main() {
  console.log("hello world!", process.env.MI_USER);
  const config = {
    userId: process.env.MI_USER!, // Xiaomi Account
    password: process.env.MI_PASS!, // Account Password
    did: process.env.MI_DID, // Device ID or Name (optional - fill in after retrieving from the device list)
  };
  const MiNA = await getMiNA(config);
  const MiIOT = await getMiIOT(config);
  console.log("MiNA devices", await MiNA?.getDevices());
  console.log("MiIOT devices", await MiIOT?.getDevices());
  // Find your device Spec here: https://home.miot-spec.com/
  await MiIOT.doAction(5, 1, "Hello world, 你好!");
}

main();

❤️ Acknowledgement

Package Sidebar

Install

npm i mi-service-lite

Weekly Downloads

9

Version

2.3.0

License

MIT

Unpacked Size

53.7 kB

Total Files

6

Last publish

Collaborators

  • del.wang