[{"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":""}]