『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 7338|回复: 9

[流程系列] node red 的体感温度

[复制链接]

11

主题

258

帖子

961

积分

高级会员

Rank: 4

积分
961
金钱
703
HASS币
0
发表于 2019-6-12 10:52:25 | 显示全部楼层 |阅读模式
本帖最后由 hisoo 于 2019-8-1 15:52 编辑

前几天用nodered画个了个空调自动化,用到了yinjiong大神体感温度插件。因到格力空调的原因把ha升到了0.94.1,结果杯具了,插件不好用了,参照插件做了个nodered的体感温度,幼儿园水平,请多指点。
大神的贴子https://bbs.hassbian.com/thread-4940-1-1.html[插件发布] 室内体感温度插件,可用于空调自动化
QQ截图20190612102834.png

[{"id":"9e7e5724.c78fd8","type":"trigger-state","z":"5879f2b4.6f914c","name":"主卧温度变化","server":"5ef70ae9.2b1354","entityid":"sensor.air_purifier_temp_zhuwo","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":260,"y":660,"wires":[["8c434058.aaebb","466f6fe8.cedd9"],[]]},{"id":"3e26d022.2b60e","type":"trigger-state","z":"5879f2b4.6f914c","name":"主卧湿度变化","server":"5ef70ae9.2b1354","entityid":"sensor.air_purifier_humid_zhuwo","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":260,"y":740,"wires":[["466f6fe8.cedd9","8c434058.aaebb"],[]]},{"id":"8c434058.aaebb","type":"api-current-state","z":"5879f2b4.6f914c","name":"主卧温度","server":"5ef70ae9.2b1354","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"sensor.air_purifier_temp_zhuwo","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":480,"y":660,"wires":[["63cdbb54.601604"]]},{"id":"466f6fe8.cedd9","type":"api-current-state","z":"5879f2b4.6f914c","name":"主卧湿度","server":"5ef70ae9.2b1354","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"sensor.air_purifier_humid_zhuwo","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":480,"y":740,"wires":[["63cdbb54.601604"]]},{"id":"63cdbb54.601604","type":"join","z":"5879f2b4.6f914c","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":710,"y":660,"wires":[["5312faee.0d6634"]]},{"id":"5312faee.0d6634","type":"function","z":"5879f2b4.6f914c","name":"体感温度","func":"var T = msg.payload['sensor.air_purifier_temp_zhuwo'];\nvar RH = msg.payload['sensor.air_purifier_humid_zhuwo'];\nif (RH < 1)\n{\n    RH = RH * 100;\n}\nT = 1.8 * T + 32;\nHI = 0.5 * (T + 61 + (T - 68) * 1.2 + RH * 0.094);\nif (HI >= 80)\n{\n     HI = -42.379 + 2.04901523 * T + 10.14333127 * RH - .22475541 * T * RH - .00683783 * T * T - .05481717 * RH * RH + .00122874 * T * T * RH + .00085282 * T * RH * RH - .00000199 * T * T * RH * RH;\n\n    if ((RH < 13) && (T > 80) && (T < 122))\n    {\n            ADJUSTMENT = (13 - RH) / 4 * math.sqrt((17 - abs(T - 95)) / 17) \n            HI -= ADJUSTMENT \n    }\n    else if ((RH > 85) && (T > 80) && (T < 87))\n    {\n            ADJUSTMENT = (RH - 85) * (87 - T) / 50 \n            HI += ADJUSTMENT \n    }\n}\n\nfunction keepXDecimalFull(num, x) {\n    var result = parseFloat(num);\n    if (isNaN(result)) {\n        console.log('传递参数错误,请检查!');\n        return false;\n    }\n    var times = Math.pow(10, x);\n    result = Math.round(num * times) / times;\n    var s_x = result.toString();\n    var pos_decimal = s_x.indexOf('.');\n    if (pos_decimal < 0) {\n        pos_decimal = s_x.length;\n        s_x += '.';\n    }\n    while (s_x.length <= pos_decimal + x) {\n        s_x += '0';\n    }\n      return s_x;\n    }\n \n\nHI = (HI - 32)/1.8;\nHI = keepXDecimalFull(HI,1)\nmsg.payload = HI;\n//msg.payload = `${(new Date()).toLocaleTimeString()} heat n xi ${msg.payload['sensor.air_purifier_temp_xiwo']} ke ${msg.payload['sensor.air_purifier_temp_pro']} zhu ${msg.payload['sensor.air_purifier_temp_zhuwo']}`\n//toLocaleTimeString 17:42:28\n//toLocaleString 2019-1-20 16:23:59\nreturn msg\n","outputs":1,"noerr":0,"x":960,"y":660,"wires":[["7828ba92.779de4","5420e1e2.44884","6d9fa28d.de4f3c","61959f13.a504c"]]},{"id":"5420e1e2.44884","type":"function","z":"5879f2b4.6f914c","name":"mqtt消息整理","func":"var payload = {}\npayload.zhuwo_AT = msg.payload;\n\nmsg.payload = payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":1240,"y":760,"wires":[["96da8c17.7bf35"]]},{"id":"96da8c17.7bf35","type":"mqtt out","z":"5879f2b4.6f914c","name":"mqtt转发主卧体感温度","topic":"/node-red/zhuwo_AT","qos":"0","retain":"","broker":"ef2f2af4.c25da8","x":1460,"y":760,"wires":[]},{"id":"5ef70ae9.2b1354","type":"server","z":"","name":"Home Assistant 2","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true},{"id":"ef2f2af4.c25da8","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.6","port":"1883","clientid":"red2","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]


评分

参与人数 1金钱 +7 收起 理由
ufonba + 7 厉害了word楼主!

查看全部评分

回复

使用道具 举报

8

主题

2073

帖子

6053

积分

论坛元老

流水无味

Rank: 8Rank: 8

积分
6053
金钱
3980
HASS币
145

灌水之王

发表于 2019-6-12 14:31:21 | 显示全部楼层
以前有个体感插件的,  用nr更方便 666
回复

使用道具 举报

13

主题

333

帖子

1418

积分

金牌会员

Rank: 6Rank: 6

积分
1418
金钱
1085
HASS币
0
发表于 2019-6-12 16:02:41 | 显示全部楼层
太棒了,正苦于没有那个插件
回复

使用道具 举报

13

主题

333

帖子

1418

积分

金牌会员

Rank: 6Rank: 6

积分
1418
金钱
1085
HASS币
0
发表于 2019-6-12 16:08:51 | 显示全部楼层
楼主,你的start-up-trigger节点是哪来的?
回复

使用道具 举报

11

主题

258

帖子

961

积分

高级会员

Rank: 4

积分
961
金钱
703
HASS币
0
 楼主| 发表于 2019-6-21 06:42:05 | 显示全部楼层
本帖最后由 hisoo 于 2019-6-21 07:05 编辑
ufonba 发表于 2019-6-12 16:08
楼主,你的start-up-trigger节点是哪来的?

应该是直接安装来的
回复

使用道具 举报

5

主题

169

帖子

1401

积分

金牌会员

Rank: 6Rank: 6

积分
1401
金钱
1232
HASS币
0
发表于 2019-6-25 00:28:19 | 显示全部楼层
@hisoo

HA 如何配置呢?
回复

使用道具 举报

11

主题

258

帖子

961

积分

高级会员

Rank: 4

积分
961
金钱
703
HASS币
0
 楼主| 发表于 2019-6-25 06:41:46 | 显示全部楼层
/config/configuration.yaml中这样写
sensor:
  - platform: mqtt
    name: "pro_AT"
    state_topic: "/node-red/pro_AT"
    value_template: '{{ value_json.pro_AT }}'
    unit_of_measurement: "°C"


回复

使用道具 举报

2

主题

150

帖子

571

积分

高级会员

Rank: 4

积分
571
金钱
421
HASS币
0
发表于 2019-6-27 13:59:08 | 显示全部楼层
用的什么体感设备啊?
回复

使用道具 举报

15

主题

297

帖子

1511

积分

论坛技术达人

积分
1511
金钱
1209
HASS币
30
发表于 2019-7-3 14:10:29 | 显示全部楼层
楼主 这个怎么搞的能教教我么,我刚把nodered接进来
回复

使用道具 举报

19

主题

274

帖子

1948

积分

金牌会员

Rank: 6Rank: 6

积分
1948
金钱
1674
HASS币
50
发表于 2020-3-19 01:14:25 | 显示全部楼层
楼主大神啊,引入的流里面没有start-up-trigger这个节点。我现在链接之后也没有输出呢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-21 22:13 , Processed in 0.843985 second(s), 36 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表