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 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-xiaomi-aqara-ac-cooler

v1.0.5

Published

A homebridge plugin for Mi/Aqara AC Partner with Cool mode only

Downloads

8

Readme

适用于 米家 / Aqara 空调伴侣的 Homebridge 插件

支援 homebridge-config-ui-x 进行配置

功能

控制

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

显示

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

安装

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

配置

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

然后使用 Config UI 进行配置

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

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

| 参数 | 描述 | 必须配置 | |-|-|:-:| | accessory | "MiHeaterCooler"                             | ✓ | | name     | 名称唯一                                       | ✓ | | address   | 空调伴侣的 ip 地址                              | ✓ | | token     | 执行 miio --discover 命令获取, 或者使用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       ||

其它

自动支持大部分品牌的第一套预设方案

否则, 你可以用 Android 模拟器(如 BlueStacks)和抓包工具 Wireshark 抓取并分析空调伴侣的命令码(执行 miio --token 空调伴侣token --json-dump 报文 命令获取),然后修改位于插件目录下的 template.json 文件

{
  "010500378033333102": {
    "tpl": "0180333331${p}${m}${w}${s}${th}${l}2",
    "brand": "haier",
    "set": "1"
  }
}

主键是空调伴侣的 model,执行 miio --control 空调伴侣ip --method get_model_and_state 命令获取

tpl 是该 model 的命令模板,用 ES6 模板字符串编写,可用以下变量:

/**
 * 生成命令码
 *
 * 如果你的方案下空调伴侣发出的命令形如 01xxxxxxxxpmwstlx(正如大部分品牌第一套预设方案一样)
 * 则无须此配置
 *
 * 用 ES6 模板字符串编写
 * 支持 +, -, *, /, %, ?:, [], toString(16) 等运算
 *
 * @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' : 关
 */