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

能否支持电热毯分区温控呢? #877

Closed
JirachiZhang opened this issue Nov 13, 2022 · 4 comments
Closed

能否支持电热毯分区温控呢? #877

JirachiZhang opened this issue Nov 13, 2022 · 4 comments

Comments

@JirachiZhang
Copy link

JirachiZhang commented Nov 13, 2022

您好~
型号:qushui.blanket.mj1
这款水暖电热毯支持AB分区温控,目前分区和温控都不可用,不知道能不能支持一下呢

@al-one
Copy link
Owner

al-one commented Nov 23, 2022

已为该设备完善部分控制实体,不过该设备AB分区控制是将多个参数组装成一个字符串,不太适合使用HA实体去实现。
请查考实体属性中的a_sleep_setting/b_sleep_setting的值通过xiaomi_miot.set_miot_property服务去控制。
以下为该设备米家插件中组装控制命令的代码:

function() {
    var n = t.state,
        l = n.firstTemperature,
        o = n.secondTemperature,
        s = n.thirdTemperature,
        u = n.forthTemperature,
        f = n.repeatValue,
        c = n.repeatCustomArray,
        p = n.isSleepModeOpen,
        S = n.start,
        h = n.end,
        y = n.afterSleepStatus,
        T = (0, V.printf)('%02d',p ? 1 : 0),
        C = S.split(':').join(''),
        b = h.split(':').join(''),
        k = 0;
    if(0 === f) k = 0;
    else if(1 === f) k = 127;
    else if(2 === f) k = 31;
    else if(3 === f) k = 96;
    else if(4 === f)
        for(var w = 0; w < c.length; w++)
            0 === c[w] ? k |= 64 : k |= 1 << c[w] - 1;
    var E = T + "/" + C + b + "/" + (0, V.printf)('%03d',k) + "/" + (0, V.printf)('%02d',y) + "/" + (0, V.printf)('%02d%02d%02d%02d',l,o,s,u);
    t.setSleepSetting(t.state.range,E).then(function(n) {
        t.props.navigation.goBack()
    })
}

@al-one al-one closed this as completed Dec 1, 2022
@JirachiZhang
Copy link
Author

非常感谢

@al-one
Copy link
Owner

al-one commented Dec 12, 2022

通过下面的服务可以控制分区温度:

service: xiaomi_miot.set_property
data:
  entity_id: switch.qushui_mj1_xxxx
  field: custom.a_target_temperature
  value: 3536
service: xiaomi_miot.set_property
data:
  entity_id: switch.qushui_mj1_xxxx
  field: custom.a_target_temperature
  value: 3500

@tsgxwolf
Copy link

通过下面的服务可以控制分区温度:

service: xiaomi_miot.set_property
data:
  entity_id: switch.qushui_mj1_xxxx
  field: custom.a_target_temperature
  value: 3536
service: xiaomi_miot.set_property
data:
  entity_id: switch.qushui_mj1_xxxx
  field: custom.a_target_temperature
  value: 3500

请问这个有办法封装成实体吗,缺少这个功能,分区温控还是需要很繁琐的打开米家

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants