Energy Dashboard + SQL

Hi

my goal is to have a energy-dashboard for multiple consumers and a SQL-database for saving data. Hardware is up and running.

Thanks to this forum, I already can read out all relevant data via modbus (node-red-contrib-modbus). I also have a basic dashboard (node-red-dashboard) and writing to SQL works (node-red-node-sqlite).

Now I have some (basic) questions regarding more detailed data-processing, where I have not found solutions yet. I will ask the questions step by step...

I read the electric power P1 and P2 from two different consumers and display them. In some cases I also want to display the sum (P1+P2) or even the difference (P1-P2) - how can I do that?

Here is a small extraction of my project

[{"id":"358902bd362de869","type":"group","z":"5c1cfa6176e89b23","name":"Test","style":{"label":true},"nodes":["84dd32dc7b3e9315","e2d73a893eba36cf","9c9667531623af10","bc59c19b8e7f3a79","9b8d97ddc575370a","6605234fe61afaf0","42cd4f2a9408be84","a24123c84780aed0","3eef6e0e5df04f6e"],"x":74,"y":99,"w":972,"h":262},{"id":"84dd32dc7b3e9315","type":"modbus-read","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"Power P1 (W)","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"6","dataType":"HoldingRegister","adr":"32077","quantity":"2","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"1fa6af670418434d","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":190,"y":140,"wires":[["e2d73a893eba36cf"],[]]},{"id":"e2d73a893eba36cf","type":"buffer-parser","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"Power","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":370,"y":140,"wires":[["bc59c19b8e7f3a79"]]},{"id":"9c9667531623af10","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P1 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":920,"y":140,"wires":[]},{"id":"bc59c19b8e7f3a79","type":"function","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"convert (W to kW) & rounding","func":"msg.payload = Math.round((msg.payload/1000) * 10) / 10;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":140,"wires":[["9c9667531623af10"]]},{"id":"9b8d97ddc575370a","type":"modbus-read","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"Power P2 (W)","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"255","dataType":"HoldingRegister","adr":"32077","quantity":"2","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"1fa6af670418434d","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":190,"y":240,"wires":[["6605234fe61afaf0"],[]]},{"id":"6605234fe61afaf0","type":"buffer-parser","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"Power","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":370,"y":240,"wires":[["42cd4f2a9408be84"]]},{"id":"42cd4f2a9408be84","type":"function","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"convert (W to kW) & rounding","func":"msg.payload = Math.round((msg.payload/1000) * 10) / 10;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":240,"wires":[["a24123c84780aed0"]]},{"id":"a24123c84780aed0","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P2 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":920,"y":240,"wires":[]},{"id":"3eef6e0e5df04f6e","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P1+P2 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":930,"y":320,"wires":[]},{"id":"1fa6af670418434d","type":"modbus-client","name":"Trafo 7 Schneider","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"172.20.39.211","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"0","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true,"showWarnings":true,"showLogs":true},{"id":"a51173d2f89918d2","type":"ui_group","name":"Dashboard_Test","tab":"914279a7ba6a5984","order":5,"disp":true,"width":"6","collapse":false,"className":""},{"id":"914279a7ba6a5984","type":"ui_tab","name":"By_Dashboard","icon":"dashboard","disabled":false,"hidden":false}]

In case someone also has advice / proposal for optimization (e.g. making things easier), this is also very welcome... I'm still a beginner in Node-Red.
Thanks in advance.

To operate on properties from different messages you need to get them into the same message. There are 2 main ways of doing so.

  • Join node
  • Store values in context, retrieve from context when you need to use them

See this article in the cookbook for an example of how to join messages into one object.

Instead of duplicating function nodes, I would recommend you get to grips with the Link-Call nodes

thank you Steve-Mcl - great hint... this will be agreat help in a big dashboard and improves clarity

also thanks for the hint with "join"... I tried now for quite some time but did not get it working... probably because I'm not very familar with msg.payload / msg.parts... is join also to way to make P1-P2 instead of P1+P2?

I also didn't understand this hint??? sorry, I'm a newbie in node-red

[{"id":"358902bd362de869","type":"group","z":"5c1cfa6176e89b23","name":"Test","style":{"label":true},"nodes":["84dd32dc7b3e9315","e2d73a893eba36cf","9c9667531623af10","9b8d97ddc575370a","6605234fe61afaf0","a24123c84780aed0","3eef6e0e5df04f6e","6ce3dbb2a89cbc54","853f3cdb4f2eb2ce","79023a40718d81ea","96167288014520bc","392a13672de977ff","8d5be842405e35a6","e52092998ed2162b"],"x":74,"y":99,"w":1312,"h":342},{"id":"84dd32dc7b3e9315","type":"modbus-read","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"Power P1 (W)","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"6","dataType":"HoldingRegister","adr":"32077","quantity":"2","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"1fa6af670418434d","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":190,"y":140,"wires":[["e2d73a893eba36cf"],[]]},{"id":"e2d73a893eba36cf","type":"buffer-parser","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"Power","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":370,"y":140,"wires":[["392a13672de977ff"]]},{"id":"9c9667531623af10","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P1 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":1260,"y":140,"wires":[]},{"id":"9b8d97ddc575370a","type":"modbus-read","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"Power P2 (W)","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"255","dataType":"HoldingRegister","adr":"32077","quantity":"2","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"1fa6af670418434d","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":190,"y":240,"wires":[["6605234fe61afaf0"],[]]},{"id":"6605234fe61afaf0","type":"buffer-parser","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"Power","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":370,"y":240,"wires":[["8d5be842405e35a6"]]},{"id":"a24123c84780aed0","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P2 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":1260,"y":240,"wires":[]},{"id":"3eef6e0e5df04f6e","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P1+P2 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":1270,"y":320,"wires":[]},{"id":"6ce3dbb2a89cbc54","type":"join","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":990,"y":320,"wires":[["3eef6e0e5df04f6e","e52092998ed2162b"]]},{"id":"853f3cdb4f2eb2ce","type":"link in","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"link in 1","links":[],"x":445,"y":380,"wires":[["96167288014520bc"]]},{"id":"79023a40718d81ea","type":"link out","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"link out 1","mode":"return","links":[],"x":835,"y":380,"wires":[]},{"id":"96167288014520bc","type":"function","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"convert (W to kW) & rounding","func":"msg.payload = Math.round((msg.payload/1000) * 10) / 10;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":380,"wires":[["79023a40718d81ea"]]},{"id":"392a13672de977ff","type":"link call","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"W to kW","links":["853f3cdb4f2eb2ce"],"linkType":"static","timeout":"30","x":640,"y":140,"wires":[["9c9667531623af10","6ce3dbb2a89cbc54"]]},{"id":"8d5be842405e35a6","type":"link call","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"W to kW","links":["853f3cdb4f2eb2ce"],"linkType":"static","timeout":"30","x":640,"y":240,"wires":[["a24123c84780aed0","6ce3dbb2a89cbc54"]]},{"id":"e52092998ed2162b","type":"debug","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"debug 93","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1140,"y":400,"wires":[]},{"id":"1fa6af670418434d","type":"modbus-client","name":"Trafo 7 Schneider","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"172.20.39.211","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"0","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true,"showWarnings":true,"showLogs":true},{"id":"a51173d2f89918d2","type":"ui_group","name":"Dashboard_Test","tab":"914279a7ba6a5984","order":5,"disp":true,"width":"6","collapse":false,"className":""},{"id":"914279a7ba6a5984","type":"ui_tab","name":"By_Dashboard","icon":"dashboard","disabled":false,"hidden":false}]

ADMIN Edit: Put triple backticks be on their own line - for correct formatting of code blocks

You can learn a lot from the example flows for the Join node.
Go to the hamburger menu, Import. (or CTRL-i)
Select Examples, then Node-red, Sequence and Join
Study options 01 and 02, the most common usages for Join.

this is indeed also a good hint... didn't know about this before... thanks...

after some trials, I'm asking myself, if this is realy what I need... probably I formulated my request bad...

I want the sum of two values P1+P2 (e.g. 20kW + 30kW = 50kW; 60kW - 10kW =50kW)...

with join it looks to me, that I can combine two strings in one string?

I assume that P1 and P2 arrive in Node-red as two seperate messages.

Most nodes can only process one message at a time.
They retain no data from the previous message.

So you have to either ensure that the two values are in the same message (Join) or else store the first one in a context variable.
These are the two alternatives @Steve-Mcl gave you.

Usually the join option is better because context variables are potentially open to being changed by another flow or event. (variables whose scope is confined to a single function node are fairly safe from this).

I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

thank you very much for your patience...

finally I understood it :slight_smile: and managed to make the sum... but does it also works for substraction? here I always end up with "undefined" in debug node 231

[{"id":"358902bd362de869","type":"group","z":"5c1cfa6176e89b23","name":"Test","style":{"label":true},"nodes":["84dd32dc7b3e9315","e2d73a893eba36cf","9c9667531623af10","9b8d97ddc575370a","6605234fe61afaf0","a24123c84780aed0","3eef6e0e5df04f6e","6ce3dbb2a89cbc54","853f3cdb4f2eb2ce","79023a40718d81ea","96167288014520bc","392a13672de977ff","8d5be842405e35a6","e52092998ed2162b","f02e3d60ec1f4f19","bf58219a946785a8","eb57d4e94eaf8dac"],"x":74,"y":99,"w":1312,"h":382},{"id":"84dd32dc7b3e9315","type":"modbus-read","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"Power P1 (W)","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"6","dataType":"HoldingRegister","adr":"32077","quantity":"2","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"1fa6af670418434d","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":190,"y":140,"wires":[["e2d73a893eba36cf"],[]]},{"id":"e2d73a893eba36cf","type":"buffer-parser","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"Power","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":370,"y":140,"wires":[["392a13672de977ff"]]},{"id":"9c9667531623af10","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P1 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":1260,"y":140,"wires":[]},{"id":"9b8d97ddc575370a","type":"modbus-read","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"Power P2 (W)","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"255","dataType":"HoldingRegister","adr":"32077","quantity":"2","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"1fa6af670418434d","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":190,"y":240,"wires":[["6605234fe61afaf0"],[]]},{"id":"6605234fe61afaf0","type":"buffer-parser","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatbe","name":"Power","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":370,"y":240,"wires":[["8d5be842405e35a6"]]},{"id":"a24123c84780aed0","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P2 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":1260,"y":240,"wires":[]},{"id":"3eef6e0e5df04f6e","type":"ui_gauge","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","group":"a51173d2f89918d2","order":2,"width":"0","height":"0","gtype":"gage","title":"Power P1+P2 (kW)","label":"kW","format":"{{value}}","min":"0","max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"100","diff":false,"className":"","x":1270,"y":320,"wires":[]},{"id":"6ce3dbb2a89cbc54","type":"join","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":830,"y":320,"wires":[["f02e3d60ec1f4f19","bf58219a946785a8"]]},{"id":"853f3cdb4f2eb2ce","type":"link in","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"link in 1","links":[],"x":125,"y":380,"wires":[["96167288014520bc"]]},{"id":"79023a40718d81ea","type":"link out","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"link out 1","mode":"return","links":[],"x":515,"y":380,"wires":[]},{"id":"96167288014520bc","type":"function","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"convert (W to kW) & rounding","func":"msg.payload = Math.round((msg.payload/1000) * 10) / 10;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":380,"wires":[["79023a40718d81ea"]]},{"id":"392a13672de977ff","type":"link call","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"W to kW","links":["853f3cdb4f2eb2ce"],"linkType":"static","timeout":"30","x":640,"y":140,"wires":[["9c9667531623af10","6ce3dbb2a89cbc54"]]},{"id":"8d5be842405e35a6","type":"link call","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"W to kW","links":["853f3cdb4f2eb2ce"],"linkType":"static","timeout":"30","x":640,"y":240,"wires":[["a24123c84780aed0","6ce3dbb2a89cbc54"]]},{"id":"e52092998ed2162b","type":"debug","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"debug 93","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1240,"y":380,"wires":[]},{"id":"f02e3d60ec1f4f19","type":"change","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"sum","rules":[{"t":"set","p":"payload","pt":"msg","to":"$sum(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":320,"wires":[["3eef6e0e5df04f6e","e52092998ed2162b"]]},{"id":"bf58219a946785a8","type":"change","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"substraction","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.two-payload.one","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1010,"y":440,"wires":[["eb57d4e94eaf8dac"]]},{"id":"eb57d4e94eaf8dac","type":"debug","z":"5c1cfa6176e89b23","g":"358902bd362de869","name":"debug 231","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1250,"y":440,"wires":[]},{"id":"1fa6af670418434d","type":"modbus-client","name":"Trafo 7 Schneider","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"172.20.39.211","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"0","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true,"showWarnings":true,"showLogs":true},{"id":"a51173d2f89918d2","type":"ui_group","name":"Dashboard_Test","tab":"914279a7ba6a5984","order":5,"disp":true,"width":"6","collapse":false,"className":""},{"id":"914279a7ba6a5984","type":"ui_tab","name":"By_Dashboard","icon":"dashboard","disabled":false,"hidden":false}]

Not quite. You need to use the Join node in key/value mode as described in the cookbook article linked earlier. Then you will be able to tell which item is which. Which doesn't matter when summing but does matter when taking the difference. Go back and look at that article again.