https://github.com/yinhangcode/homebridge-mi-fan
XiaoMi fan plugins for HomeBridge.
https://github.com/yinhangcode/homebridge-mi-fan
fan homebridge homebridge-plugin mi xiaomi zhimi
Last synced: 7 months ago
JSON representation
XiaoMi fan plugins for HomeBridge.
- Host: GitHub
- URL: https://github.com/yinhangcode/homebridge-mi-fan
- Owner: YinHangCode
- Created: 2017-09-05T13:05:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-01T09:00:42.000Z (about 1 year ago)
- Last Synced: 2024-11-09T13:57:05.642Z (8 months ago)
- Topics: fan, homebridge, homebridge-plugin, mi, xiaomi, zhimi
- Language: JavaScript
- Size: 63.5 KB
- Stars: 62
- Watchers: 6
- Forks: 17
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# homebridge-mi-fan
[](https://badge.fury.io/js/homebridge-mi-fan)XiaoMi fan plugins for HomeBridge.
Thanks for [nfarina](https://github.com/nfarina)(the author of [homebridge](https://github.com/nfarina/homebridge)), [OpenMiHome](https://github.com/OpenMiHome/mihome-binary-protocol), [aholstenson](https://github.com/aholstenson)(the author of [miio](https://github.com/aholstenson/miio)), [ABC](https://github.com/hassbian-ABC), 小马哥, all other developer and testers.**Note: If you find bugs, please submit them to [issues](https://github.com/YinHangCode/homebridge-mi-fan/issues) or
QQ Group: [245480](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=gZitewfJ7tC8UBPco-vHE-lWlQ2MSFj4&authKey=vM9HTpEBVpb6vVIHtwnRxFdsUKN0dh1A%2FUihq0BnOtLzEykzEaBZVQjbYINWucxd&noverify=0&group_code=245480)
(~~previous [15987618](https://qm.qq.com/cgi-bin/qm/qr?k=ZiAkKhlOCyjpSq94Xb6-MsiKCxLtoDAJ&jump_from=webapi)~~)
(~~previous [107927710](//shang.qq.com/wpa/qunwpa?idkey=8b9566598f40dd68412065ada24184ef72c6bddaa11525ca26c4e1536a8f2a3d)~~).**


## Supported Devices
1.ZhiMiDCVariableFrequencyFan(智米直流变频落地扇 799RMB)
2.ZhiMiNaturalWindFan(智米自然风风扇 599RMB)
3.MiDCVariableFrequencyFan(米家直流变频落地扇 399RMB)
4.DmakerFan(米家风扇1X 299RMB)
5.DmakerFanp5c(新款米家智能直流变频落地扇1X)## Pre-Requirements
1.Make sure your IOS version is ios11 or later.
## Installation
1. Install HomeBridge, please follow it's [README](https://github.com/nfarina/homebridge/blob/master/README.md).
If you are using Raspberry Pi, please read [Running-HomeBridge-on-a-Raspberry-Pi](https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi).
2. Make sure you can see HomeBridge in your iOS devices, if not, please go back to step 1.
3. Install packages.
```
npm install -g homebridge-mi-fan
```
## Configuration
```
"platforms": [{
"platform": "MiFanPlatform",
"deviceCfgs": [{
"type": "ZhiMiDCVariableFrequencyFan",
"ip": "192.168.1.xxx",
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"fanName": "room fan",
"fanDisable": false,
"temperatureName": "room temperature",
"temperatureDisable": false,
"humidityName": "room humidity",
"humidityDisable": false,
"buzzerSwitchName": "fan buzzer switch",
"buzzerSwitchDisable": true,
"ledBulbName": "fan led switch",
"ledBulbDisable": true
}, {
"type": "ZhiMiNaturalWindFan",
"ip": "192.168.1.xxx",
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"fanName": "room fan",
"fanDisable": false,
"temperatureName": "room temperature",
"temperatureDisable": false,
"humidityName": "room humidity",
"humidityDisable": false,
"buzzerSwitchName": "fan buzzer switch",
"buzzerSwitchDisable": true,
"ledBulbName": "fan led switch",
"ledBulbDisable": true
}, {
"type": "MiDCVariableFrequencyFan",
"ip": "192.168.1.xxx",
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"fanName": "room fan",
"fanDisable": false,
"temperatureName": "room temperature",
"temperatureDisable": false,
"humidityName": "room humidity",
"humidityDisable": false,
"buzzerSwitchName": "fan buzzer switch",
"buzzerSwitchDisable": true,
"ledBulbName": "fan led switch",
"ledBulbDisable": true
}, {
"type": "DmakerFan",
"ip": "192.168.1.xxx",
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"fanName": "room fan",
"fanDisable": false,
"buzzerSwitchName": "fan buzzer switch",
"buzzerSwitchDisable": true,
"ledBulbName": "fan led switch",
"ledBulbDisable": true
},
{
"type": "DmakerFanP5c",
"ip": "192.168.1.xxx",
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"deviceId":"xxxxxxx",
"fanName": "room fan",
"fanDisable": false,
"buzzerSwitchName": "fan buzzer switch",
"buzzerSwitchDisable": true,
"ledBulbName": "fan led switch",
"ledBulbDisable": true
}]
}]
```## Get token
### Get token by miio2.db
setup MiJia(MiHome) app in your android device or android virtual machine.
open MiJia(MiHome) app and login your account.
refresh device list and make sure device display in the device list.
get miio2.db(path: /data/data/com.xiaomi.smarthome/databases/miio2.db) file from your android device or android virtual machine.
open website [[Get MiIo Tokens By DataBase File](http://miio2.yinhh.com/)], upload miio2.db file and submit.
### Get token by network
Open command prompt or terminal. Run following command:
```
miio --discover
```
Wait until you get output similar to this:
```
Device ID: xxxxxxxx
Model info: Unknown
Address: 192.168.88.xx
Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx via auto-token
Support: Unknown
```
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" is token.
If token is "???", then reset device and connect device created Wi-Fi hotspot.
Run following command:
```
miio --discover --sync
```
Wait until you get output.
For more information about token, please refer to [OpenMiHome](https://github.com/OpenMiHome/mihome-binary-protocol) and [miio](https://github.com/aholstenson/miio).## Version Logs
### 0.1.2 (2024-04-24)
1.add support for DmakerFanP5c.
### 0.1.1 (2019-06-03)
1.add support for DmakerFan.
### 0.1.0 (2018-07-11)
1.add support for Mi DC VariableFrequency Fan.
2.add support for ZhiMi NaturalWind Fan.
### 0.0.5 (2018-02-10)
1.update 'package.json'.
### 0.0.4 (2017-09-11)
1.optimized code.
### 0.0.3 (2017-09-09)
1.optimized code.
### 0.0.2 (2017-09-09)
1.fixed bug that led switch error.
### 0.0.1 (2017-09-05)
1.support for ZhiMi DC VariableFrequency Fan.