Hi guys,
Here I am again, as I was afraid already before trying to solve this issue..
Last time the help and guidance was great, so I'll give it 1 more shot on my issue.
I spent again a few evenings trying to get my mind around the below flow, but all I did is made some spaghetti on the wiring of the nodes.. Although it does partly seem to work now.
Thing is, I believe there should be a 100 times easier solution, or perhaps not without some coding into a function node?
What I am trying to do:
Input is the states of my heat pump at home. When it is in mode 2-3-4 or 5, I want to count the heat energy from another input and store it per mode. This input itself keeps counting up nevertheless the status (unless 1, that is " Stop" ). I am now that far that I store the start number into a context flow., together with the end number, and deduct this from each other. Just a few issues:
On start-up it gives an error due to no value(s) yet. Only once, because then the trigger is waiting for a reset.
I cannot seem to figure out how to count all single run values into a total value (once done I will also read into the function to store data better).
It got very messy with all the connections, is there an easier way to do this which I overlooked?
Just a push into the right direction would be awesome already!
Thanks a lot!
[{"id":"13936b55.057715","type":"trigger","z":"e48134ce.946038","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":1720,"wires":[["16610f01.96e4a1"]]},{"id":"5e17cc5d.a00384","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1720,"wires":[["13936b55.057715"]]},{"id":"16610f01.96e4a1","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"swwtstart","pt":"flow","to":"payload.totalheatenergy","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1250,"y":1720,"wires":[[]]},{"id":"a72fdf81.4ca46","type":"change","z":"e48134ce.946038","name":"SWW calc T","rules":[{"t":"set","p":"payload.swwtstart","pt":"msg","to":"swwtstart","tot":"flow"},{"t":"set","p":"payload.swwt","pt":"msg","to":"(payload.totalheatenergy - payload.swwtstart)*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1230,"y":1760,"wires":[["89f5ead9.0593d8"]]},{"id":"89f5ead9.0593d8","type":"join","z":"e48134ce.946038","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1470,"y":1760,"wires":[["51aa100e.6955d"]]},{"id":"a224a5eb.1091e8","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1820,"wires":[["a9be45c3.599898"]]},{"id":"c814a831.4d5978","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"heatingtstart","pt":"flow","to":"payload.totalheatenergy","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":1820,"wires":[[]]},{"id":"f01d4895.76c168","type":"change","z":"e48134ce.946038","name":"Heating calc T","rules":[{"t":"set","p":"payload.heatingtstart","pt":"msg","to":"heatingtstart","tot":"flow"},{"t":"set","p":"payload.heatingt","pt":"msg","to":"(payload.totalheatenergy - payload.heatingtstart)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":1860,"wires":[["89f5ead9.0593d8"]]},{"id":"525a2e0e.c2985","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1920,"wires":[["87382041.5a83c"]]},{"id":"87382041.5a83c","type":"trigger","z":"e48134ce.946038","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":1920,"wires":[["26ac73e8.7581fc"]]},{"id":"26ac73e8.7581fc","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"coolingtstart","pt":"flow","to":"payload.totalheatenergy","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":1920,"wires":[[]]},{"id":"d33d5ee5.7f7da","type":"change","z":"e48134ce.946038","name":"Cooling calc T","rules":[{"t":"set","p":"payload.coolingtstart","pt":"msg","to":"coolingtstart","tot":"flow"},{"t":"set","p":"payload.coolingt","pt":"msg","to":"(payload.totalheatenergy - payload.coolingtstart)*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":1960,"wires":[["89f5ead9.0593d8"]]},{"id":"872db087.9dbea","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":2020,"wires":[["2273432e.4309bc"]]},{"id":"2273432e.4309bc","type":"trigger","z":"e48134ce.946038","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":2020,"wires":[["f57142a0.6a561"]]},{"id":"f57142a0.6a561","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"defrosttstart","pt":"flow","to":"payload.totalheatenergy","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":2020,"wires":[[]]},{"id":"5b265318.ed4bfc","type":"change","z":"e48134ce.946038","name":"Defrost calc T","rules":[{"t":"set","p":"payload.defrosttstart","pt":"msg","to":"defrosttstart","tot":"flow"},{"t":"set","p":"payload.defrostt","pt":"msg","to":"(payload.totalheatenergy - payload.defrosttstart)*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":2060,"wires":[["89f5ead9.0593d8"]]},{"id":"86ebed86.23e19","type":"comment","z":"e48134ce.946038","name":"Calculate thermal energy per run per mode","info":"","x":900,"y":1680,"wires":[]},{"id":"a9be45c3.599898","type":"trigger","z":"e48134ce.946038","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":1820,"wires":[["c814a831.4d5978"]]},{"id":"75db2867.909cf8","type":"trigger","z":"e48134ce.946038","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":1760,"wires":[["a72fdf81.4ca46"]]},{"id":"e40cf164.35702","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1760,"wires":[["75db2867.909cf8"]]},{"id":"2c32ca90.76cd06","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1860,"wires":[["bee62ff0.efd9"]]},{"id":"bee62ff0.efd9","type":"trigger","z":"e48134ce.946038","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":1860,"wires":[["f01d4895.76c168"]]},{"id":"78d2e3d5.f2c05c","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1960,"wires":[["4403ca52.2913f4"]]},{"id":"4403ca52.2913f4","type":"trigger","z":"e48134ce.946038","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":1960,"wires":[["d33d5ee5.7f7da"]]},{"id":"f5a7f392.f7e0e","type":"change","z":"e48134ce.946038","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":2060,"wires":[["41b59be0.e23ff4"]]},{"id":"41b59be0.e23ff4","type":"trigger","z":"e48134ce.946038","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1020,"y":2060,"wires":[["5b265318.ed4bfc"]]},{"id":"aee1976c.ac49b8","type":"switch","z":"e48134ce.946038","name":"Check operating mode","property":"mitsubishi.operation_mode","propertyType":"msg","rules":[{"t":"eq","v":"Stop","vt":"str"},{"t":"eq","v":"Hot Water","vt":"str"},{"t":"eq","v":"Heating","vt":"str"},{"t":"eq","v":"Cooling","vt":"str"},{"t":"eq","v":"Freeze stat","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":560,"y":1760,"wires":[["5e17cc5d.a00384","a224a5eb.1091e8","39165ba7.0370e4","525a2e0e.c2985","872db087.9dbea","75db2867.909cf8","bee62ff0.efd9","4403ca52.2913f4","41b59be0.e23ff4"],["13936b55.057715","a224a5eb.1091e8","525a2e0e.c2985","872db087.9dbea","e40cf164.35702","bee62ff0.efd9","4403ca52.2913f4","41b59be0.e23ff4"],["5e17cc5d.a00384","525a2e0e.c2985","872db087.9dbea","a9be45c3.599898","75db2867.909cf8","2c32ca90.76cd06","4403ca52.2913f4","41b59be0.e23ff4"],["5e17cc5d.a00384","a224a5eb.1091e8","872db087.9dbea","87382041.5a83c","75db2867.909cf8","bee62ff0.efd9","78d2e3d5.f2c05c","41b59be0.e23ff4"],["5e17cc5d.a00384","a224a5eb.1091e8","525a2e0e.c2985","2273432e.4309bc","75db2867.909cf8","bee62ff0.efd9","f5a7f392.f7e0e","4403ca52.2913f4"]]}]