merdok / homebridge-xiaomi-fan

Homebridge plugin for Xiaomi Smartmi and Mija fans
MIT License
113 stars 15 forks source link
dmaker fan homebridge homekit smartmi xiaomi

homebridge-xiaomi-fan

verified-by-homebridge homebridge-xiaomi-fan mit-license follow-me-on-twitter join-discord

homebridge-xiaomi-fan is a plugin for homebridge which allows you to control Xiaomi Smartmi and Mija Fans! It should work with most smart fans from xiaomi. The goal is to make the fan fully controllable from the native Homekit iOS app and Siri.

Features

Known supported fan models

Installation

If you are new to homebridge, please first read the homebridge documentation. If you are running on a Raspberry, you will find a tutorial in the homebridge wiki.

Install homebridge:

sudo npm install -g homebridge

Install homebridge-xiaomi-fan:

sudo npm install -g homebridge-xiaomi-fan

Configuration

Add the xiaomifan platform in config.json in your home directory inside .homebridge.

Add your Fan or multiply Fans in the devices or fans array.

Example configuration:

{
  "platforms": [
    {
      "platform": "xiaomifan",
      "devices": [
        {
          "name": "Xiaomi Fan 2s",
          "ip": "192.168.0.40",
          "token": "8305d8fba83f94bb5ad8f963b6c84c84",
          "pollingInterval": 10,
          "moveControl": true,
          "buzzerControl": true,
          "ledControl": true,
          "naturalModeControl": true,
          "shutdownTimer": true,
          "angleButtons": [
             5,
             60,
             100
           ]
        }
      ]
    }
  ]
}

Token

For the plugin to work the device token is required. For methods on how to find the token refer to this guide obtaining mi device token.

You can also use this tool to easily retrieve the token: Xiaomi Cloud Tokens Extractor.

Configuration

Platform Configuration fields

Troubleshooting

If you have any issues with the plugin or fan services then you can run homebridge in debug mode, which will provide some additional information. This might be useful for debugging issues.

Homebridge debug mode:

homebridge -D

Deep debug log, add the following to your config.json:

"deepDebugLog": true

This will enable additional extra log which might be helpful to debug all kind of issues.

Special thanks

miio - the Node.js remote control module for Xiaomi Mi devices.

HAP-NodeJS & homebridge - for making this possible.