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

homebridge-miio-local

v0.2.2

Published

Homebridge plugin for Xiaomi miio devices over the LAN, without the Xiaomi cloud

Readme

homebridge-miio-local

Homebridge plugin that exposes Xiaomi devices to Apple Home over the LAN with the miio protocol. It does not use the Xiaomi cloud.

Supported devices

| Model | Device | Dialect | Status | |---|---|---|---| | zhimi.fan.za1 | Pedestal fan | legacy miio | supported | | dmaker.fan.p33 | Pedestal fan | miot | supported | | zhimi.humidifier.ca4 | Evaporative humidifier | miot | supported; writes not verified on a real device |

The model is detected from the device. Both fans are exposed in the same way.

For the humidifier only reads were measured on a real device. Its writes follow the published miot spec and have been run against a fake device only.

Install

The package is not on npm yet. Build a tarball and install it where Homebridge keeps its plugins:

npm install
npm run build
npm pack
npm install homebridge-miio-local-<version>.tgz

Configure

{
  "platform": "MiioLocal",
  "night": { "start": "22:00", "end": "07:00" },
  "devices": [
    {
      "name": "Bedroom fan",
      "address": "192.168.1.50",
      "token": "<32 hex characters>",
      "moveSwitches": true,
      "buzzer": "off",
      "lightAtNight": "off"
    }
  ]
}

| Setting | Meaning | |---|---| | night.start, night.end | When the night values are used, as local time HH:MM of the Homebridge host. Without it they never are | | name | The name the accessory is added with | | address | IP address of the device. Give it a fixed address on the router: the accessory is tied to it | | token | The 32 hex character miio token of the device | | pollInterval | Seconds between state reads, 15 by default | | moveSwitches | Fans: adds the Move Left and Move Right switches, off by default | | buzzer, light | on or off: the plugin keeps the device at that value. unmanaged, the default: left alone. light is the indicator light of a fan and the screen of the humidifier | | buzzerAtNight, lightAtNight | The value during the night. same, the default: the day value. With an unmanaged day value, the device gets back what it had before the night |

A device that does not answer when Homebridge starts is asked again every 30 seconds and added once it answers. When another model answers at the address of an accessory, that accessory is removed and the device is added as a new one. An accessory whose device is left out of the configuration for a bad token stays in HomeKit, shown as not responding, until the token is fixed.

What Apple Home shows

One accessory per fan:

| Control | Notes | |---|---| | Power | | | Speed | 1-100 %. Setting a speed turns the fan on, unless the same request turns it off | | Oscillation | Ignored while the fan is off | | Child lock | | | Move Left, Move Right switches | The head keeps turning, one step every 0.75 s, while the switch is on |

Turning a move switch off stops the head after at most the step that was already sent. A move switch that is left on turns itself off once the head has had enough steps to cross its whole range (about 18 to 22 s), and turning one on turns the other off. A move turns oscillation off first.

A control shows its new value at once. If the fan does not take it, the control goes back to what the fan has. A fan that stops answering, or that answers three reads in a row with an error, is shown as No Response.

Natural wind, the oscillation angle and the timer are not exposed. A fan in natural wind stays in it when the speed changes.

One accessory for the humidifier:

| Control | Notes | |---|---| | Power | | | Mode | Auto is the humidifier's automatic mode. Humidify is a manual level | | Speed | The manual level: up to 33 % low, up to 66 % medium, above that high | | Target humidity | Kept within 30-80 % | | Current humidity, water level | The water level scale is python-miio's and was not measured | | Child lock | |

The temperature, the dry mode and the clean mode are not exposed. A light kept on sets the screen to its brightest level; a dim screen counts as on. A dim screen that the night turned off therefore comes back at its brightest level, not dim.

Device behaviour

docs/local-api.md records how the devices behave on the wire, as measured on real ones. The plugin relies on it. For the humidifier only reads were measured.

Development

npm test            # unit and integration tests against a fake device on localhost
npm run typecheck
npm run fmt

test/support/fake-device.ts answers miio as any of the three models, following the measured behaviour, and can be told to stop answering, lose a reply or change state as if someone used the remote. How it takes writes as the humidifier is an assumption taken from the spec.

License

Apache License 2.0. See LICENSE.