Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues setting this up #17

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
91a9cfb
合并湿度显示,不再显示为单独传感器
seanzhang98 Aug 8, 2021
2d782ad
Update package.json
seanzhang98 Aug 8, 2021
20382e7
仅保留制冷模式
seanzhang98 Aug 10, 2021
6fc920c
更新 readme
seanzhang98 Aug 10, 2021
cda61df
added config UI
seanzhang98 Aug 10, 2021
e0cb6d0
added config UI
seanzhang98 Aug 10, 2021
d8eefed
Minor update
seanzhang98 Aug 10, 2021
93b94df
Added description for config UI
seanzhang98 Aug 10, 2021
d85d01d
Update config-sample.json
seanzhang98 Aug 10, 2021
9a97db4
Update README.md
seanzhang98 Aug 13, 2021
cf9e462
Update config.schema.json
seanzhang98 Aug 13, 2021
5f92b27
Update package.json
seanzhang98 Aug 13, 2021
3d86f59
Merge branch 'master' of https://github.com/seanzhang98/homebridge-Aq…
seanzhang98 Aug 13, 2021
40256f6
Create Config.png
seanzhang98 Aug 13, 2021
9d52b91
Update README.md
seanzhang98 Aug 13, 2021
ad5aa9a
📦 Added Device Info Setting
seanzhang98 Aug 25, 2021
a5e8ae4
🎁 Update Doc
seanzhang98 Aug 25, 2021
48a18b9
🎁 Update Config UI
seanzhang98 Aug 25, 2021
4b15e43
Create logo.png
seanzhang98 Aug 25, 2021
1233128
Update README.md
seanzhang98 Aug 25, 2021
4b4f75b
Update README.md
seanzhang98 Aug 25, 2021
07d2fcc
Create .Rhistory
seanzhang98 Aug 26, 2021
504a0cc
🎁 Update package name
seanzhang98 Aug 29, 2021
34228de
Update README.md
seanzhang98 Sep 2, 2021
6dc162c
Update package.json
seanzhang98 Sep 27, 2021
49cd6ab
Update README.md
seanzhang98 Sep 27, 2021
0dc0f77
Merge branch 'master' of https://github.com/seanzhang98/homebridge-Xi…
seanzhang98 Sep 27, 2021
070ccb6
Update README.md
seanzhang98 Dec 9, 2021
2ec4fec
Update README.md
seanzhang98 Dec 9, 2021
0af894a
Update README.md
seanzhang98 Dec 9, 2021
9522974
Added English Readme
seanzhang98 Dec 9, 2021
52f751a
Update README.md
seanzhang98 Dec 9, 2021
2abb6ab
Update README_EN.md
seanzhang98 Dec 9, 2021
f763dce
Create package.json
seanzhang98 Dec 31, 2021
019f9e1
Update README.md
seanzhang98 Dec 31, 2021
64cfa24
Update README_EN.md
seanzhang98 Dec 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .Rhistory
Empty file.
120 changes: 0 additions & 120 deletions README-CN.md

This file was deleted.

153 changes: 85 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,108 @@
# homebridge-mi-heatercooler
<p align="center">
<a href="https://github.com/homebridge/homebridge"><img src="https://raw.githubusercontent.com/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler/master/images/logo.png" height="240"></a>
</p>

[![npm version](https://badge.fury.io/js/homebridge-mi-heatercooler.svg)](https://badge.fury.io/js/homebridge-mi-heatercooler)
<h1 align="center">
Homebridge Xiaomi Aqara AC Cooler</h1>

English | [中文](https://github.com/jayqizone/homebridge-mi-heatercooler/blob/master/README-CN.md)
<p align="center">
<a href="README.md"><font size=4><b>简体中文</b></font></a>
<font size=4><b>·</b></font>
<a href="README_EN.md"><font size=4><b>English</b></font></a>
</p>

Mi / Aqara AC partner plugin for [Homebridge](https://github.com/nfarina/homebridge)
<p align="center"> <a href="https://github.com/homebridge/homebridge/wiki/Verified-Plugins"><img src="https://badgen.net/badge/homebridge/verified/purple"></a> <a href=""><img src="https://img.shields.io/npm/dy/homebridge-xiaomi-aqara-ac-cooler"></a> <a href=""><img src="https://img.shields.io/github/package-json/v/seanzhang98/homebridge-xiaomi-aqara-ac-cooler"></a> <a href=""><img src="https://img.shields.io/github/languages/top/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler"></a></p>

## Feature

### Control
适用于 米家 / Aqara 空调伴侣的 [Homebridge](https://github.com/nfarina/homebridge) 插件

- Mode
- heat
- cool
- auto
- Temperature
- 17 - 30 Celsius
- Fan speed
- 1 : low
- 2 : medium
- 3 : high
- 4 : auto
- Oscillate
- LED
- only if set `enableLED` in config
- would add a bulb accessory in Home app
支援 homebridge-config-ui-x 进行配置

![](https://raw.githubusercontent.com/jayqizone/homebridge-mi-heatercooler/master/images/control.PNG)
## 功能

### Display
### 控制
- 仅保留制冷模式
- 温度
- 17 - 30 度
- 风速
- 1 : 低
- 2 : 中
- 3 : 高
- 4 : 自动
- 摆动
- 灯光
- 仅当 `enableLED` 为 true 时
- 作为单独的灯光配件

- Sync state with AC partner
- Idle / Working color
- idle : green
- heating : orange
- cooling : blue
- Current power percent
- only if set `ratedPower` in config
- display as Battery Level
- Current temperature & humidity
- only if set `sensorId` in config
- would add a humidity sensor in Home app
<img src="https://raw.githubusercontent.com/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler/master/images/tmp.PNG" width = "500" align=center />

![](https://raw.githubusercontent.com/jayqizone/homebridge-mi-heatercooler/master/images/state.PNG)

## Installation
### 显示

- 空调伴侣状态同步
- 空闲 / 工作 颜色区分
- 空闲 : 绿
- 制冷 : 蓝
- 当前功率(百分比)
- 仅当设定了 `ratedPower`(额定功率)时
- 作为「电池电量」显示
- 当前温、湿度
- 仅当指定了温湿度传感器的 `sensorId` 时
- 湿度集成在空调内,不以单独传感器显示

<img src="https://raw.githubusercontent.com/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler/master/images/con.PNG" width = "500" align=center />

## 安装

```bash
npm i -g [email protected] homebridge homebridge-mi-heatercooler
npm i -g [email protected] homebridge-xiaomi-aqara-ac-cooler
```

## Configuration
## 配置

首先需要获取空调伴侣的token 以及 IP 地址

First, you should enable ac partner's developer mode in MiHome app
然后使用 Config UI 进行配置

Then, add this to config.json in Homebridge directory:
<img src="https://raw.githubusercontent.com/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler/master/images/Config.png" width = "1500" align=center />

或者在 Homebridge 的 config.json 中加入如下配置:

```json
"accessories": [
{
"accessory": "MiHeaterCooler",
"name": "AC Partner",
"address": "192.168.1.154",
"Manufacturer": "Aqara",
"Model": "KTBL11LM",
"token": "71b4e85d8527aab32c8f9175124c0d59",
"sensorId": "158d0001a4c582",
"enableLED": true,
"enableLED": false,
"ratedPower": 735
}
]
```

| Parameter | Description | Required |
| 参数 | 描述 | 必须配置 |
|-|-|:-:|
| `accessory` | "MiHeaterCooler"                                                                     | ✓ |
| `name`     | unique name                                                                          | ✓ |
| `address`   | your AC partner ip address                                                           | ✓ |
| `token`     | run `miio --discover` to get it                                                      | ✓ |
| `sensorId`   | humidity-temperature sensor (bound to your AC partner) id. run `miio --control yourACPartnerIP --method get_device_prop --params '["lumi.0", "device_list"]'` to get it (without 'lumi.' prefix) ||
| `enableLED`  | true or 'true' to enable LED control                                                 ||
| `ratedPower` | Watt, your AC Normal Rated Power, used for displaying power percent by battery level ||
| `idlePower` | Watt, determine whether current working state is idle, default value is 100          ||
| `accessory` | "MiHeaterCooler"                             | ✓ |
| `name`     | 名称唯一                                       | ✓ |
| `address`   | 空调伴侣的 ip 地址                              | ✓ |
| `token`     | 执行 `miio --discover` 命令获取, 或者使用[Get_MiHome_devices_token](https://github.com/Maxmudjon/Get_MiHome_devices_token)                | ✓ |
| `Manufacturer` | 用于显示设备生产商信息,默认为Aqara       | ✓ |
| `Model` | 用于显示设备型号信息,默认为二代空调伴侣       | ✓ |
| `sensorId`   | 温湿度传感器 (必须绑定到此空调伴侣) id。执行 `miio --control 空调伴侣ip --method get_device_prop --params '["lumi.0", "device_list"]'` 命令获取(去除 'lumi.' 前缀)||
| `enableLED`  | true 或 'true'                                ||
| `ratedPower` | 瓦,空调额定功率,用于以「电池电量」显示当前功率百分比 ||
| `idlePower` | 瓦,用于判定当前是否处于空闲状态,默认值为 100       ||


## Extra
## 其它

Auto supports most of brands set 1 solution
自动支持大部分品牌的第一套预设方案

Otherwise, you should use an Android simulator (like [BlueStacks](http://www.bluestacks.com)) and [Wireshark](https://www.wireshark.org) to collect and analyze your AC partner command codes by `miio --token yourACPartnerToken --json-dump packetFile`, then modify `template.json` in plugin directory
否则, 你可以用 Android 模拟器(如 [BlueStacks](http://www.bluestacks.com))和抓包工具 [Wireshark](https://www.wireshark.org) 抓取并分析空调伴侣的命令码(执行 `miio --token 空调伴侣token --json-dump 报文` 命令获取),然后修改位于插件目录下的 `template.json` 文件

```json
{
Expand All @@ -97,26 +114,26 @@ Otherwise, you should use an Android simulator (like [BlueStacks](http://www.blu
}
```

The key is your current AC partner solution model, you can get it by `miio --control yourACPartnerIP --method get_model_and_state`
主键是空调伴侣的 model,执行 `miio --control 空调伴侣ip --method get_model_and_state` 命令获取

"tpl" is this model's command template, you can use ES6 Template Literals with these params:
tpl 是该 model 的命令模板,用 ES6 模板字符串编写,可用以下变量:

```js
/**
* generate command
* 生成命令码
*
* if your ac partner sends commands like 01xxxxxxxxpmwstlx (most of brands set 1 do)
* then you don't need template config
* 如果你的方案下空调伴侣发出的命令形如 01xxxxxxxxpmwstlx(正如大部分品牌第一套预设方案一样)
* 则无须此配置
*
* template uses ES6 Template Literals to generate commands
* supports +, -, *, /, %, ?:, [], toString(16) and so on
* ES6 模板字符串编写
* 支持 +, -, *, /, %, ?:, [], toString(16) 等运算
*
* @param p number power 0 : off, 1 : on
* @param m number mode 0 : heat, 1 : cool, 2 : auto
* @param w number wind speed 0 : low, 1 : medium, 2 : high, 3 : auto
* @param s number swing 0 : enabled, 1 : disabled
* @param td number temperature decimal
* @param th string temperature hexadecimal
* @param l string led '0' : on, 'a' : off
* @param p number 开关 0 : , 1 :
* @param m number 模式 0 : 制热, 1 : 制冷, 2 : 自动
* @param w number 风速 0 : , 1 : , 2 : , 3 : 自动
* @param s number 摆动 0 : , 1 :
* @param td number 温度 十进制
* @param th string 温度 十六进制
* @param l string 灯光 '0' : , 'a' :
*/
```
```
67 changes: 67 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<p align="center">
<a href="https://github.com/homebridge/homebridge"><img src="https://raw.githubusercontent.com/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler/master/images/logo.png" height="240"></a>
</p>

<h1 align="center">
Homebridge Xiaomi Aqara AC Cooler</h1>

<p align="center">
<a href="README.md"><font size=4><b>简体中文</b></font></a>
<font size=4><b>·</b></font>
<a href="README_EN.md"><font size=4><b>English</b></font></a>
</p>

<p align="center"> <a href="https://github.com/homebridge/homebridge/wiki/Verified-Plugins"><img src="https://badgen.net/badge/homebridge/verified/purple"></a> <a href=""><img src="https://img.shields.io/npm/dy/homebridge-xiaomi-aqara-ac-cooler"></a> <a href=""><img src="https://img.shields.io/github/package-json/v/seanzhang98/homebridge-xiaomi-aqara-ac-cooler"></a> <a href=""><img src="https://img.shields.io/github/languages/top/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler"></a></p>

A [Homebridge](https://github.com/nfarina/homebridge) plugin for / XiaoMi / Aqara AC partner

With homebridge-config-ui-x support

## Functions

### Control
- Only keeps the Cool mode
- Temperature
- 17 - 30 Celsius
- Fan speed
- 1 : Low
- 2 : medium
- 3 : high
- 4 : auto
- Oscillate
- LED
- only when `enableLED` set to true
- as a light accessory

<img src="https://raw.githubusercontent.com/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler/master/images/tmp.PNG" width = "500" align=center />


### Display

- Sync state with AC partner
- Idle / Working color
- idle : green
- heating : orange
- cooling : blue
- Current power percent
- only if set `ratedPower` in config
- display as Battery Level
- Current temperature & humidity
- only if set `sensorId` in config

<img src="https://raw.githubusercontent.com/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler/master/images/con.PNG" width = "500" align=center />

## Installation

```bash
npm i -g [email protected] homebridge-xiaomi-aqara-ac-cooler
```

## Config

Get the token and IP address for the AC partner

Use the Config UI to setup

<img src="https://raw.githubusercontent.com/seanzhang98/homebridge-Xiaomi-Aqara-AC-Cooler/master/images/Config.png" width = "1500" align=center />

Loading