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.