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

 找回密码
 立即注册
查看: 13512|回复: 12

[进阶教程] hass终于接入太阳能的深度和温度数据了

[复制链接]

43

主题

412

帖子

3806

积分

元老级技术达人

积分
3806
金钱
3389
HASS币
136
发表于 2020-10-9 12:09:34 | 显示全部楼层 |阅读模式
本帖最后由 hunterfox 于 2020-10-9 19:50 编辑

终于接入太阳能的数据了,主要采样了水温和水的深度 1.png




一直想接入,只是找不到很好很精确的深度测量方法
现在用的,

水温用的防水的DS18B20,  这个采样精度0.01 微信图片_20201009120322.jpg
水深度通过气压传感器采集的,气压传感器测水温受 热胀冷缩影响比较大,  我还没有换算出关系。其他精度测量还是很准确的,


微信图片_20201009120327.jpg

通过 这两项数据,可以演化出很多场景出来


水少提醒,下一步,水自动切燃气热水电动阀门
水满提醒,下一步,可以作为太阳能上水的电子罚的控制数据源
水温,可以自动决定今天是启用太阳能还是燃气热水

2.png
附node red 流
[{"id":"c1268beb.a56c68","type":"server-state-changed","z":"ea976bea.458cf8","name":"水位-气压","server":"2b887588.e131fa","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.s06_10","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":160,"y":720,"wires":[["69bee2aa.08ec6c"]]},{"id":"394d2f76.ea789","type":"comment","z":"ea976bea.458cf8","name":"室外太阳能数据","info":"","x":140,"y":420,"wires":[]},{"id":"128077de.879da8","type":"server-state-changed","z":"ea976bea.458cf8","name":"水温","server":"2b887588.e131fa","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.s01_10","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":150,"y":480,"wires":[["da9c7b07.7dfc28"]]},{"id":"fa489194.c1247","type":"server-state-changed","z":"ea976bea.458cf8","name":"室外照度","server":"2b887588.e131fa","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.s02_10","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":160,"y":600,"wires":[["ff90cdb9.47395"]]},{"id":"4ee7bd4d.0f76f4","type":"server-state-changed","z":"ea976bea.458cf8","name":"室外-降水","server":"2b887588.e131fa","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.s03_10","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":160,"y":660,"wires":[["4abc6ed0.fc542"]]},{"id":"a694be9e.37236","type":"mqtt out","z":"ea976bea.458cf8","name":"水位-气压","topic":"a/sensor/home_outsunwater/home/state","qos":"","retain":"","broker":"37541fbf.c8804","x":1220,"y":640,"wires":[]},{"id":"da9c7b07.7dfc28","type":"switch","z":"ea976bea.458cf8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"41","vt":"num","v2":"60","v2t":"num"},{"t":"lt","v":"41","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":480,"wires":[["74443551.8f4c6c","d4cf8c8.b370e7"],["74443551.8f4c6c","e5ae8fda.ccb1c"]]},{"id":"74443551.8f4c6c","type":"mqtt out","z":"ea976bea.458cf8","name":"太阳能水温","topic":"a/sensor/home_outsuntemp/home/state","qos":"","retain":"","broker":"37541fbf.c8804","x":530,"y":460,"wires":[]},{"id":"d09e441f.ac5f18","type":"mqtt out","z":"ea976bea.458cf8","name":"室外-照度","topic":"a/sensor/home_outlight/home/state","qos":"","retain":"","broker":"37541fbf.c8804","x":460,"y":600,"wires":[]},{"id":"ee41325f.040af","type":"mqtt out","z":"ea976bea.458cf8","name":"降水","topic":"a/sensor/home_outwator/home/state","qos":"","retain":"","broker":"37541fbf.c8804","x":450,"y":660,"wires":[]},{"id":"4abc6ed0.fc542","type":"function","z":"ea976bea.458cf8","name":"","func":"var msg1={};\nvar a;\na=(500-Number(msg.payload))/5;\nmsg1.payload =a.toFixed(0); \nreturn msg1;\n","outputs":1,"noerr":0,"x":310,"y":660,"wires":[["ee41325f.040af"]]},{"id":"6fd201bb.b0bc1","type":"switch","z":"ea976bea.458cf8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"100","v2t":"num"},{"t":"gte","v":"100","vt":"num"},{"t":"lt","v":"10","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":930,"y":720,"wires":[["a694be9e.37236"],["d21530c2.a18c","d5a315d.d9598e8"],["3693ff4b.a6d87"]]},{"id":"96d1a111.62181","type":"mqtt out","z":"ea976bea.458cf8","name":"太阳能状态","topic":"a/binary/B02_10/10/state","qos":"","retain":"","broker":"37541fbf.c8804","x":770,"y":520,"wires":[]},{"id":"e5ae8fda.ccb1c","type":"change","z":"ea976bea.458cf8","name":"输出1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":540,"wires":[["96d1a111.62181"]]},{"id":"d4cf8c8.b370e7","type":"change","z":"ea976bea.458cf8","name":"输出0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":500,"wires":[["96d1a111.62181"]]},{"id":"ff90cdb9.47395","type":"function","z":"ea976bea.458cf8","name":"","func":"var msg1={};\nvar a;\na=(Number(msg.payload)-200)*3;\nmsg1.payload =a.toFixed(0); \nreturn msg1;\n","outputs":1,"noerr":0,"x":310,"y":600,"wires":[["d09e441f.ac5f18"]]},{"id":"d19b2747.2bc868","type":"api-current-state","z":"ea976bea.458cf8","name":"太阳能水温","server":"2b887588.e131fa","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.home_outsuntemp","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":470,"y":720,"wires":[["d73dc7ac.faa838"]]},{"id":"d73dc7ac.faa838","type":"change","z":"ea976bea.458cf8","name":"watertemp","rules":[{"t":"move","p":"payload","pt":"msg","to":"watertemp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":720,"wires":[["e6573558.172528"]]},{"id":"69bee2aa.08ec6c","type":"change","z":"ea976bea.458cf8","name":"watergas","rules":[{"t":"move","p":"payload","pt":"msg","to":"watergas","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":720,"wires":[["d19b2747.2bc868"]]},{"id":"e6573558.172528","type":"function","z":"ea976bea.458cf8","name":"字段组合","func":"var watergas = (msg.watergas);\nvar watertemp = (msg.watertemp);\nvar msg1={};\nvar a;\na=(Number(watergas)-24500)/50;\nmsg1.payload =a.toFixed(0); \nreturn msg1;\n//温度每涨1读,估算增加80个单位的低压值 (Number(watergas)+10*(Number(watertemp)-20)-24500)。\n\n","outputs":1,"noerr":0,"x":780,"y":720,"wires":[["6fd201bb.b0bc1"]]},{"id":"c3350b4f.a0c7d8","type":"inject","z":"ea976bea.458cf8","name":"提醒上水","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"00 07 * * *","once":false,"onceDelay":0.1,"x":150,"y":860,"wires":[["2ce7e7e6.ee8188"]]},{"id":"20db9da5.384db2","type":"api-call-service","z":"ea976bea.458cf8","name":"太阳能水已经上满,请及时关闭上水阀","server":"2b887588.e131fa","version":1,"debugenabled":false,"service_domain":"notify","service":"hass_synchat","entityId":"","data":"{"message":"太阳能水已经上满,请及时关闭上水阀!"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1450,"y":780,"wires":[[]]},{"id":"3693ff4b.a6d87","type":"api-call-service","z":"ea976bea.458cf8","name":"太阳能水位低于告警值,请注意切换热水器","server":"2b887588.e131fa","version":1,"debugenabled":false,"service_domain":"notify","service":"hass_synchat","entityId":"","data":"{"message":"太阳能水位低于告警值仅剩10%,请注意切换热水器!"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1170,"y":820,"wires":[[]]},{"id":"2ce7e7e6.ee8188","type":"api-current-state","z":"ea976bea.458cf8","name":"太阳能水位","server":"2b887588.e131fa","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.home_outsunwater","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":330,"y":860,"wires":[["f80a3b4c.3da888"]]},{"id":"f80a3b4c.3da888","type":"switch","z":"ea976bea.458cf8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"100","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":485.78472900390625,"y":861.2222290039062,"wires":[["9fbb7fa1.3ed6f"]]},{"id":"9fbb7fa1.3ed6f","type":"function","z":"ea976bea.458cf8","name":"字段组合","func":"var a;\na=msg.payload;\n\nvar messages =`提醒:太阳能水位未上满,目前为${a},自动上水功能目前暂未启用,请及时手动补充`;\nvar msg1= {};\nvar msg2= {};\nmsg1.payload = {};\nmsg1.payload.data ={"message":messages};\nmsg2.payload=messages;\nreturn[msg1,msg2];","outputs":2,"noerr":0,"x":640,"y":860,"wires":[["3ba7d360.0efc6c"],[]]},{"id":"3ba7d360.0efc6c","type":"api-call-service","z":"ea976bea.458cf8","name":"上水提醒","server":"2b887588.e131fa","version":1,"debugenabled":false,"service_domain":"notify","service":"hass_synchat","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":840,"y":860,"wires":[[]]},{"id":"68a9589e.2078d8","type":"inject","z":"ea976bea.458cf8","name":"提醒水温","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"00 18 * * *","once":false,"onceDelay":0.1,"x":170,"y":940,"wires":[["506dfa1b.880bb4"]]},{"id":"506dfa1b.880bb4","type":"api-current-state","z":"ea976bea.458cf8","name":"太阳能水温","server":"2b887588.e131fa","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.home_outsuntemp","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":350,"y":940,"wires":[["238e5037.724f3"]]},{"id":"238e5037.724f3","type":"switch","z":"ea976bea.458cf8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"41","vt":"str"},{"t":"lt","v":"40","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":505.78472900390625,"y":941.2222290039062,"wires":[["3b5c7e92.447e02"],["95c45c97.d8564"]]},{"id":"3b5c7e92.447e02","type":"function","z":"ea976bea.458cf8","name":"字段组合","func":"//homestate:系统通用信息组合\nvar temp=global.get('homestate');\n//ondoor:进门方式:钥匙/人脸识别\nvar ondoormode=flow.get('ondoor');\n//opendoor:行为: 进门/出门\nvar getdoor =flow.get('opendoor');\n//userid:人员信息\nvar userid =flow.get('userid');\nvar a;\na=msg.payload;\n\nvar messages =`今天太阳能水温为${a}°C,可以使用太阳能热水洗澡`;\nvar msg1= {};\nvar msg2= {};\nmsg1.payload = {};\nmsg1.payload.data ={"message":messages};\nmsg2.payload=messages;\nreturn[msg1,msg2];","outputs":2,"noerr":0,"x":660,"y":920,"wires":[["55909e9b.2fe81"],[]]},{"id":"55909e9b.2fe81","type":"api-call-service","z":"ea976bea.458cf8","name":"水温提醒","server":"2b887588.e131fa","version":1,"debugenabled":false,"service_domain":"notify","service":"hass_synchat","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":860,"y":940,"wires":[[]]},{"id":"95c45c97.d8564","type":"function","z":"ea976bea.458cf8","name":"字段组合","func":"//homestate:系统通用信息组合\nvar temp=global.get('homestate');\n//ondoor:进门方式:钥匙/人脸识别\nvar ondoormode=flow.get('ondoor');\n//opendoor:行为: 进门/出门\nvar getdoor =flow.get('opendoor');\n//userid:人员信息\nvar userid =flow.get('userid');\nvar a;\na=msg.payload;\n\nvar messages =`今天太阳能水温为${a}°C,洗澡有点冷,勇者上`;\nvar msg1= {};\nvar msg2= {};\nmsg1.payload = {};\nmsg1.payload.data ={"message":messages};\nmsg2.payload=messages;\nreturn[msg1,msg2];","outputs":2,"noerr":0,"x":660,"y":980,"wires":[["55909e9b.2fe81"],[]]},{"id":"d476d5a4.0d04a8","type":"change","z":"ea976bea.458cf8","name":"水满提醒","rules":[{"t":"set","p":"allwater","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1220,"y":740,"wires":[[]]},{"id":"d21530c2.a18c","type":"function","z":"ea976bea.458cf8","name":"","func":"\n\nvar allwater =global.get('allwater');\n\nvar messages =+`${allwater}`+1;\nvar msg1;\nmsg1= {};\nmsg1.payload=messages;\nreturn msg1;","outputs":1,"noerr":0,"x":1070,"y":780,"wires":[["c1e482b5.69f92","d476d5a4.0d04a8"]]},{"id":"c1e482b5.69f92","type":"switch","z":"ea976bea.458cf8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1210,"y":780,"wires":[["20db9da5.384db2"]]},{"id":"d5a315d.d9598e8","type":"trigger","z":"ea976bea.458cf8","op1":"","op2":"100","op1type":"nul","op2type":"num","duration":"250","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":1230,"y":700,"wires":[["a694be9e.37236"]]},{"id":"2b887588.e131fa","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"37541fbf.c8804","type":"mqtt-broker","z":"","name":"MY_MQTT","broker":"192.168.1.188","port":"1883","clientid":"Node_RED","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]




回复

使用道具 举报

175

主题

2967

帖子

7606

积分

超级版主

我就是六神

Rank: 8Rank: 8

积分
7606
金钱
4614
HASS币
398

活跃会员教程狂人灌水之王

QQ
发表于 2020-10-9 14:03:07 | 显示全部楼层
警告!只放成品不放 流文件  差评
回复

使用道具 举报

4

主题

233

帖子

1427

积分

金牌会员

Rank: 6Rank: 6

积分
1427
金钱
1194
HASS币
0
发表于 2020-10-9 14:03:22 | 显示全部楼层
涂鸦的太阳能中控好像就可以满足需求了
回复

使用道具 举报

4

主题

303

帖子

1161

积分

金牌会员

Rank: 6Rank: 6

积分
1161
金钱
848
HASS币
40
发表于 2020-10-9 16:04:12 | 显示全部楼层
请楼主务必补齐流程,谢谢
回复

使用道具 举报

22

主题

731

帖子

3810

积分

论坛元老

Rank: 8Rank: 8

积分
3810
金钱
3074
HASS币
20
发表于 2020-10-9 16:17:20 | 显示全部楼层
https://bbs.hassbian.com/thread-10152-1-1.html,我这个是不是更简单,自动化还不需要HA,直接涂鸦APP干完了。
回复

使用道具 举报

27

主题

558

帖子

4384

积分

论坛元老

Rank: 8Rank: 8

积分
4384
金钱
3826
HASS币
0
发表于 2020-10-10 20:45:55 | 显示全部楼层
我也直接涂鸦接的
回复

使用道具 举报

9

主题

527

帖子

2350

积分

金牌会员

Rank: 6Rank: 6

积分
2350
金钱
1823
HASS币
0
发表于 2021-2-23 12:18:02 | 显示全部楼层
ds18B20  精度貌似不是太好。。我做了两个用在鱼缸 差不多相差1~2度
回复

使用道具 举报

29

主题

365

帖子

2449

积分

金牌会员

Rank: 6Rank: 6

积分
2449
金钱
2084
HASS币
0
发表于 2023-5-5 11:44:02 | 显示全部楼层
nuaawmy 发表于 2020-10-10 20:45
我也直接涂鸦接的

涂鸦怎么接入ha
回复

使用道具 举报

27

主题

558

帖子

4384

积分

论坛元老

Rank: 8Rank: 8

积分
4384
金钱
3826
HASS币
0
发表于 2023-5-17 15:57:53 | 显示全部楼层

装一个 localtuya的集成
回复

使用道具 举报

23

主题

243

帖子

2321

积分

金牌会员

Rank: 6Rank: 6

积分
2321
金钱
2078
HASS币
0
发表于 2023-9-16 20:25:59 来自手机 | 显示全部楼层
我也用气压水位传感器的,随着时间推移而数值慢慢变小。很不稳定
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-26 20:22 , Processed in 0.103956 second(s), 36 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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