LASER-Yi / homebridge-mi-acpartner

XiaoMi AC Partner plugins for HomeBridge(https://github.com/nfarina/homebridge).
MIT License
262 stars 36 forks source link

试着抓了下格力 3 预设 #71

Open lslqtz opened 5 years ago

lslqtz commented 5 years ago

2019.07.10 更新

修改后的 t0t,如果使用 off_fix 的原版 t0t 会导致在 HomeKit 内选取关闭后温度被设定为 16 度(或者更低),应用到米家和下次开机中。 至于 t0t 的 presetUtil.js 基本是原样拷下来的。。就不补充了,感觉可能是有点费空间和不优雅了。。

"description_06": "off_fix is not available on gree_3 (a part of the ir code, error temperature off+on)",
"gree3t0t": {
    "cool": "1",
    "heat": "1",
    "auto_fix": "A"
}
"main": "{po}{mo}{wi}{sw}1{gree3t0t}1100{gree3wtw}{pmp}{t0t}2050021{gree3swfix}2000{t6t}0"

上面和下面是 presets.json 的部分

"0100002607": {
        "des": "gree_3",
        "main": "{po}{mo}{wi}{sw}1{t0t}1100{gree3wtw}{pmp}{t0t}2050021{gree3swfix}2000{t6t}0",
        "extra_value": ["pmp","t0t","t6t","gree3sr2","gree3wtw","gree3swfix"]
}
"description_04": "auto (default) -> low (+1) -> middle (+1) -> high (+1)",
"gree3wtw": 4,
"description_05": "mode status string replace",
"gree3sr2": {
    "off": "0",
    "cool": "A",
    "heat": "4",
    "auto": "1"
}

gree3wtw 与 wtw 相比有一点小区别,因为每一个风力都是加 1 的。然后如果是扫风状态的话,这个数值需要减 4。(4,5,6,7 和 0,1,2,3) gree3swfix 是在原有 Swing({sw}) 的基础上再加 1,因为只是简单增减数值,我放在 presetutil 里了。。 gree3sr2 名字实在想不到,就这样写上来了。。 实际使用的话经我测试,温度调节,风速调节和扫风均为正常,但没有细化到各模式各温度风速扫风去测试。。 灯光是写死的,因为 HomeKit 不支持而且不想找灯光的码了。。想起来了这可能导致米家的灯光设置不会同步过来,倒也无妨。。

下面是 presetUtil.js 的部分

case "gree3wtw":
    replace_code = parseInt(globalValue.wtw, 16);
    switch (speed_str) {
        case "high":
            replace_code += 1;
        case "middle":
            replace_code += 1;
        case "low":
            replace_code += 1;
        case "auto":
            break;
    }
    if (sw == 0) {
        replace_code -= 4;
    }
    replace_code = replace_code.toString(16).substr(-1).toUpperCase();
    code = code.replace(/\{gree3wtw\}/g, replace_code);
    break;
case "gree3sr2":
    replace_code = globalValue.gree3sr2[origin_mode_str];
    code = code.replace(/\{gree3sr2\}/g, replace_code);
    break;
case "gree3swfix":
    code = code.replace(/\{gree3swfix\}/g, 1 - sw + 1);
    break;

部分抓码数值 风速 20 度(应该是,模拟器上面有部分看不到不好判断。。建议无视) 制冷 自动:010000260711【3】01a1100【4】90A20500211200000 低速:010000260711【0】01a1100【5】90A20500211200000 中速:010000260711【1】01a1100【6】90A20500211200000 高速:010000260711【2】01a1100【7】90A20500211200000 制热 自动:010000260710【3】0141100【4】C04205002112000D0 低速:010000260710【0】0141100【5】C04205002112000D0 中速:010000260710【1】0141100【6】C04205002112000D0 高速:010000260710【2】0141100【7】C04205002112000D0 自动(当前模式下,温度不可控) 自动:010000260712【3】0111100【4】80120500211200060 低速:010000260712【0】0111100【5】80120500211200060 中速:010000260712【1】0111100【6】80120500211200060 高速:010000260712【2】0111100【7】80120500211200060 送风 自动:010000260714【3】0141100【4】B04205002112000C0 低速:010000260714【0】0141100【5】B04205002112000C0 中速:010000260714【1】0141100【6】B04205002112000C0 高速:010000260714【2】0141100【7】B04205002112000C0 除湿 自动:010000260713【3】0141100【4】A04205002112000B0 低速:010000260713【0】0141100【5】A04205002112000B0 中速:010000260713【1】0141100【6】A04205002112000B0 高速:010000260713【2】0141100【7】A04205002112000B0

扫风状态(应该也许大概可能也是 20 度吧。。) 制冷 开:0100002607112【0】141100【7】904205002112000A0 关:0100002607112【1】141100【3】904205002122000A0 制热 开:0100002607102【0】141100【7】C04205002112000D0 关:0100002607102【1】141100【3】C04205002122000D0

lslqtz commented 5 years ago

忘记怎么用 Markdown 的格式了,然后命名似乎不太 ok,对我而言能用就行了。。我的插件已经百经魔改了

lslqtz commented 5 years ago

对于我的空调,格力 2 预设没法调整扫风(在米家也是这样的),不过在我所用的插件版本中扫风也是不能使用的(魔改的太多,不好升级,就再次魔改后能用了)。

LASER-Yi commented 5 years ago

感谢你的工作!我之前试着抓过格力2的预设,非常难看懂,而且还有间歇性的无法控制的问题,晚点我尝试着用这套预设更新一下插件