Skip to content
Homebridge plugin for Xiaomi Smartmi fans
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
CHANGELOG.md
LICENSE
README.md
config.schema.json
index.js
obtain_token.md
package.json

README.md

homebridge-xiaomi-fan

homebridge-xiaomi-fan is a plugin for Homebridge which allows you to control your Xiaomi Smartmi Fan! 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

  • Integrates into homekit as a fan device
  • Control power, speed, swing mode and switch beetwen standard and natural wind
  • Rotate fan to the left or right by 5°
  • Turn on/off the buzzer
  • Turn on/off the LEDs

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-punt Wiki.

Install homebridge:

sudo npm install -g homebridge

Install homebridge-xiaomi-fan:

sudo npm install -g homebridge-xiaomi-fan

Configuration

Add the accessory in config.json in your home directory inside .homebridge.

Example configuration:

{
  "accessories": [
    {
      "accessory": "xiaomifan",
      "name": "Xiaomi Fan 2s",
      "ip": "192.168.0.40",
      "token": "8305d8fba83f94bb5ad8f963b6c84c84",
      "pollingInterval": 10,
      "moveControl": true,
      "buzzerControl": true,
      "ledControl": false
    }
  ]  
}

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.

Configuration fields

  • accessory [required] Should always be "xiaomifan".
  • name [required] Name of your accessory.
  • ip [required] ip address of your Fan.
  • token [required] The device token of your Fan.
  • prefsDir [optional] The directory where the fan device info will be stored. Default: "~/.xiaomiFan"
  • pollingInterval [optional] The fan state background polling interval in seconds. Default: 5
  • moveControl [optional] Whether the move service is enabled. This allows to move the fan in 5° to the left or right. Default: true
  • buzzerControl [optional] Whether the buzzer service is enabled. This allows to turn on/off the fan buzzer. Default: true
  • ledControl [optional] Whether the led service is enabled. This allows to turn on/off the fan LED. Default: true

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

Special thanks

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

HAP-NodeJS & homebridge - for making this possible.

You can’t perform that action at this time.