gpt4 book ai didi

javascript - 在 Apple HomeKit 中使用 Node-Red 将电量使用情况显示为温度

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:38:55 26 4
gpt4 key购买 nike

我想在 HomeKit 中显示电量使用情况。不幸的是,在 HomeKit 中没有类别可以做到这一点。这就是为什么我有想法在 HomeKit 中不将其显示为电量使用情况而是显示为温度。这个想法是用假温度传感器控制 HomeKit 场景。

不幸的是,我没有使用 node-red 的经验,这对我来说是新的。

我从电表中得到以下字符串:

success: "true"
response: string
{
"power": 3.040480,
"relay": true
}

我将其链接到 HomeKit 节点,然后返回以下错误:

Characteristic response cannot be written. 
Try one of these: Name, CurrentTemperature, StatusActive, StatusFault, StatusLowBattery, StatusTampered, Name

不幸的是,经过各种功能和其他调整后,我无法在 HomeKit 中显示“温度”。

我用这个: https://flows.nodered.org/node/@plasma2450/node-red-contrib-homekit-bridged

最佳答案

我认为你不能直接链接 2 个节点。根据错误消息,它表明您已将有效负载从仪表输出传递到 HomeKit 节点。虽然仪表输出包含 response 属性并且 HomeKit 不支持它,但会出现您的错误。

确保您的负载仅包含受支持的特征。您可以使用更改节点来修改有效负载,或者简单地使用功能节点

const msg.meterOutput = msg.payload;
// Just a prototype, type checking is required
msg.payload = {
currentTemperature: msg.meterOutput.response.power
}
return msg;

关于javascript - 在 Apple HomeKit 中使用 Node-Red 将电量使用情况显示为温度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53223465/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com