npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

midea-local

v0.1.1

Published

Local control of Midea smart air conditioners

Readme

midea-local

This is a straight port. I put zero real effort into this.

All credits, fame, and glory belong to Tucker Kern and the original Python project midea-msmart. That's where the actual reverse-engineering, protocol analysis, and hard work happened. I just ran it through a transpiler-shaped meat grinder. Go star the original repo.

What is this?

A Bun/TypeScript port of msmart-ng — a library for local network control of Midea (and associated brands) smart air conditioners. No cloud dependency at runtime, everything talks directly to the device over your LAN.

How it works

  1. Discovery — Sends UDP broadcast packets on ports 6445/20086. Devices respond with encrypted payloads containing their ID, serial number, and protocol version (V2 or V3).
  2. Authentication — V3 devices require a token/key pair fetched once from Midea's cloud API (NetHomePlus). After that, communication is fully local.
  3. Control — Commands are framed in Midea's proprietary binary protocol (0xAA header for V2, 0x8370 wrapper for V3), sent over TCP to port 6444.

Zero npm dependencies. Uses node:crypto, node:net, and node:dgram.

Usage

bun add midea-local  # or just clone this repo

Toggle a device on/off

import { Discover } from "midea-local";
import { AirConditioner } from "midea-local";

// Find the device
const device = await Discover.discoverSingle("192.168.1.100");

// Authenticate (only needed once for V3 devices)
await Discover.connect(device, {
  account: "[email protected]",
  password: "yourpassword",
});

// Read current state
await device.refresh();
console.log(`Power: ${device.powerState ? "ON" : "OFF"}`);
console.log(`Temperature: ${device.indoorTemperature}°C`);

// Toggle power
device.powerState = !device.powerState;
await device.apply();

Discover all devices on the network

const devices = await Discover.discover({
  account: "[email protected]",
  password: "yourpassword",
});

for (const device of devices) {
  console.log(`${device.name} @ ${device.ip} (${device.sn})`);
}

Run the example

bun run examples/toggle.ts <ip> <account> <password>

Supported devices

  • AC (0xAC) — Residential air conditioners (AirConditioner)
  • CC (0xCC) — Commercial air conditioners (CommercialAirConditioner)

License

Same as the original — MIT.