Thank you for your respond.
The main objective I want is to monitor the amount of energy that went IN and OUT my batteries.
All the rest is given by the inverter/charger.
The monitor is connected to a shunt directly after the batteries, so this gives the most accurate number.
"+" is Watt going in
"-" is Watt going out.
I adjusted the nodes now and am going to compare this the coming days with the N/7c010a8eed8e/battery/256/History/ChargedEnergy
.. (which shows me the charged Energy ever in this Battery)
and
N/7c010a8eed8e/battery/256/History/DischargedEnergy
..
I'm now using this setup:
[{"id":"29f34b4f.df682c","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"5eb66b22.1a4de4","type":"watt2kwh","z":"29f34b4f.df682c","format":"kwh","maximum":"5","maximumunit":"mins","name":"","x":460,"y":60,"wires":[["92e84adc.45c5e8"]]},{"id":"92e84adc.45c5e8","type":"function","z":"29f34b4f.df682c","name":"Store kwh","func":"var inputVal = msg.payload;\nif (inputVal == \"reset\"){\n flow.set(\"energyVal1\",0); \n } else {\nvar savedVal = flow.get('energyVal1')||0;\nsavedVal += inputVal;\nflow.set(\"energyVal1\",savedVal);\nmsg.payload = savedVal;\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":80,"wires":[["7ad02888.9e6b"]]},{"id":"6a75c8e5.1ee598","type":"inject","z":"29f34b4f.df682c","name":"reset","props":[{"p":"payload","v":"reset","vt":"str"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"reset","payloadType":"str","x":470,"y":100,"wires":[["92e84adc.45c5e8"]]},{"id":"28fe84cf.763174","type":"mqtt in","z":"29f34b4f.df682c","name":"Power","topic":"N/7c010a8eed8e/battery/256/Dc/0/Power","qos":"2","datatype":"json","broker":"51ed7aaa.a7200c","nl":false,"rap":true,"rh":0,"x":50,"y":60,"wires":[["a178f91f.bd2678"]]},{"id":"a178f91f.bd2678","type":"join","z":"29f34b4f.df682c","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":190,"y":60,"wires":[["ce84f947.8e3de","4f4c187.2002a68"]]},{"id":"ce84f947.8e3de","type":"function","z":"29f34b4f.df682c","name":"Only +","func":"if (msg.payload[\"N/7c010a8eed8e/battery/256/Dc/0/Power\"].value < 0) {\n msg.payload = 0\n}\nelse {\n msg.payload = msg.payload[\"N/7c010a8eed8e/battery/256/Dc/0/Power\"].value;\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":60,"wires":[["5eb66b22.1a4de4"]]},{"id":"2013f35f.1cbba4","type":"watt2kwh","z":"29f34b4f.df682c","format":"kwh","maximum":"5","maximumunit":"mins","name":"","x":460,"y":240,"wires":[["66b2c15b.2d3088"]]},{"id":"66b2c15b.2d3088","type":"function","z":"29f34b4f.df682c","name":"Store kwh","func":"var inputVal = msg.payload;\nif (inputVal == \"reset\"){\n flow.set(\"energyVal2\",0); \n } else {\nvar savedVal = flow.get('energyVal2')||0;\nsavedVal += inputVal;\nflow.set(\"energyVal2\",savedVal);\nmsg.payload = savedVal;\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":260,"wires":[["16495737.c32ef1"]]},{"id":"160c54ce.226fcb","type":"inject","z":"29f34b4f.df682c","name":"reset","props":[{"p":"payload","v":"reset","vt":"str"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"reset","payloadType":"str","x":470,"y":280,"wires":[["66b2c15b.2d3088"]]},{"id":"4f4c187.2002a68","type":"function","z":"29f34b4f.df682c","name":"Only -","func":"if (msg.payload[\"N/7c010a8eed8e/battery/256/Dc/0/Power\"].value > 0) {\n msg.payload = 0\n} else {\n msg.payload = msg.payload[\"N/7c010a8eed8e/battery/256/Dc/0/Power\"].value;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":240,"wires":[["2013f35f.1cbba4"]]},{"id":"7b6b3610.3f3bc","type":"ha-entity","z":"29f34b4f.df682c","name":"","server":"a996490d.ff3548","version":1,"debugenabled":true,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Charged_Battery"},{"property":"device_class","value":"energy"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"kWh"}],"state":"payload","stateType":"msg","attributes":[],"resend":false,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":610,"y":200,"wires":[[]]},{"id":"a44fb4f8.60bda","type":"ha-entity","z":"29f34b4f.df682c","name":"","server":"a996490d.ff3548","version":1,"debugenabled":true,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Discharged_Battery"},{"property":"device_class","value":"energy"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"kWh"}],"state":"payload","stateType":"msg","attributes":[],"resend":false,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":610,"y":380,"wires":[[]]},{"id":"7ad02888.9e6b","type":"change","z":"29f34b4f.df682c","name":"afrond","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(payload, 4)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":140,"wires":[["7b6b3610.3f3bc"]]},{"id":"16495737.c32ef1","type":"change","z":"29f34b4f.df682c","name":"afrond","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(payload, 4)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":320,"wires":[["a44fb4f8.60bda"]]},{"id":"51ed7aaa.a7200c","type":"mqtt-broker","name":"CCGX","broker":"192.168.0.50","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"a996490d.ff3548","type":"server","name":"Home Assistant","addon":true}]
Anything to polish it up? Or am I going in the right direction?
Thank you all for your help!
Sam