- 积分
- 739
- 金钱
- 713
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
高级会员
- 积分
- 739
- 金钱
- 713
- HASS币
- 0
|
发表于 2022-1-15 23:02:41
|
显示全部楼层
[ 本帖最后由 akarinwei 于 2022-1-15 23:05 编辑 ]\n\n[{"id":"4048e7e6.356be8","type":"tab","label":"洗衣机洗完通知","disabled":false,"info":""},{"id":"26d8b700.53d95a","type":"api-call-service","z":"4048e7e6.356be8","name":"通知所有手机","server":"5bb02c99.614f64","version":1,"debugenabled":false,"service_domain":"notify","service":"notify","entityId":"","data":"{\"title\":\"洗衣机\",\"message\":\"衣服洗完,本次消耗{{{flow.end}}}度,用时{{{flow.xhtime}}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1380,"y":560,"wires":[[]]},{"id":"82f5ba1.7686448","type":"server-state-changed","z":"4048e7e6.356be8","name":"洗衣机总功率<9","server":"5bb02c99.614f64","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.dc1_xiyiji_power","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"9","halt_if_type":"num","halt_if_compare":"lt","outputs":2,"output_only_on_state_change":true,"for":"60","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":180,"y":520,"wires":[["8bf8cc6c.2baeb"],[]]},{"id":"b60c1b32.41b608","type":"server-state-changed","z":"4048e7e6.356be8","name":"洗衣机总功玑�>30","server":"5bb02c99.614f64","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.dc1_xiyiji_power","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"30","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"output_only_on_state_change":true,"for":"5","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":120,"y":380,"wires":[["e334d597.529908"],[]]},{"id":"8bf8cc6c.2baeb","type":"switch","z":"4048e7e6.356be8","name":"","property":"xyj","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":520,"wires":[["384b6575.78898a","45aa1499.9a302c"],[]]},{"id":"9eb8269.34ac4d8","type":"change","z":"4048e7e6.356be8","name":"设定xyj=1","rules":[{"t":"set","p":"xyj","pt":"flow","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":380,"wires":[[]]},{"id":"384b6575.78898a","type":"change","z":"4048e7e6.356be8","name":"设定xyj=0","rules":[{"t":"set","p":"xyj","pt":"flow","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":620,"wires":[[]]},{"id":"10e54243.7a95be","type":"api-call-service","z":"4048e7e6.356be8","name":"只通知我的手机","server":"5bb02c99.614f64","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_tengyuede_iphone","entityId":"","data":"{\"title\":\"洗衣机\",\"message\":\"衣服洗完,本次消耗{{{flow.end}}}度,用时{{{flow.xhtime}}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1400,"y":480,"wires":[[]]},{"id":"e334d597.529908","type":"switch","z":"4048e7e6.356be8","name":"","property":"xyj","propertyType":"flow","rules":[{"t":"neq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":380,"wires":[["9eb8269.34ac4d8","a81653d6.39fd2","c25687cb.3a98f8"],[]],"info":"xyj=0的时候,且功率触发》30,记录当前电表读数"},{"id":"a1d3aea4.62ad9","type":"function","z":"4048e7e6.356be8","name":"计算能耗","func":"var start = flow.get('start',start);\nvar finish = flow.get('finish',finish);\nvar dianneng = finish - start;\nmsg.payload = dianneng.toFixed(2);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":800,"y":540,"wires":[["6282f71f.1b0a38"]]},{"id":"a81653d6.39fd2","type":"api-current-state","z":"4048e7e6.356be8","name":"记录开始洗电能","server":"5bb02c99.614f64","version":1,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is_not","override_topic":true,"entity_id":"sensor.dc1_xiyiji_total","state_type":"num","state_location":"start","override_payload":"flow","entity_location":"data","override_data":"msg","blockInputOverrides":true,"x":500,"y":440,"wires":[[],[]]},{"id":"45aa1499.9a302c","type":"api-current-state","z":"4048e7e6.356be8","name":"记录结束电能","server":"5bb02c99.614f64","version":1,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is_not","override_topic":true,"entity_id":"sensor.dc1_xiyiji_total","state_type":"num","state_location":"finish","override_payload":"flow","entity_location":"data","override_data":"msg","blockInputOverrides":true,"x":580,"y":520,"wires":[["a1d3aea4.62ad9","488104ff.80f39c"],[]]},{"id":"6282f71f.1b0a38","type":"change","z":"4048e7e6.356be8","name":"转移数据","rules":[{"t":"move","p":"payload","pt":"msg","to":"end","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":480,"wires":[["5cff32a1.b2cfcc"]]},{"id":"c25687cb.3a98f8","type":"function","z":"4048e7e6.356be8","name":"获取开始时间","func":"var date = new Date();\nmsg.payload = date;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":480,"y":320,"wires":[["f5b322aa.d8512"]]},{"id":"f5b322aa.d8512","type":"change","z":"4048e7e6.356be8","name":"转移数据","rules":[{"t":"move","p":"payload","pt":"msg","to":"timestart","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":280,"wires":[[]]},{"id":"488104ff.80f39c","type":"function","z":"4048e7e6.356be8","name":"计算消耗时间","func":"var nowdate = new Date();\nvar timestart = flow.get('timestart',timestart);\nvar difftime = (nowdate - timestart)/1000;\nvar hours = parseInt(difftime/3600); // 小时 60*60 总小时数-过去的小时数=现在的小时数 \nvar minutes = parseInt(difftime%3600/60); // 分钟 -(day*24) 以60秒丽�一敨�份 取余 剩下秒数 秒数/60 就是分钟数\nvar seconds = parseInt(difftime%60); // 以60秒为一整份 取余 剩下秒数\nmsg.payload = hours+\"h\"+minutes+\"min\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":800,"y":600,"wires":[["44f9d7f4.526478"]]},{"id":"44f9d7f4.526478","type":"change","z":"4048e7e6.356be8","name":"转移数据","rules":[{"t":"move","p":"payload","pt":"msg","to":"xhtime","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":640,"wires":[[]]},{"id":"5cff32a1.b2cfcc","type":"stoptimer","z":"4048e7e6.356be8","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1160,"y":480,"wires":[["26d8b700.53d95a"],[]]},{"id":"5bb02c99.614f64","type":"server","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
按解析出错提示给双引号加了转义能导入了...但是我是nodered刚入门,想用小爱音箱来提醒是不是改最后的“只通知我的手机”部分就行了 |
|