Hi i think the solution is simple but i get stuck with adding up some values.
I am a total N00b so please be patient.
Situation:
I get data from Domoticz via Mqtt. (works)
I split the messages to get only the data i need (from 3 sensors) (works)
Now the difficoult part. The output is like this:
{"Battery":255,"RSSI":12,"description":"","dtype":"Usage","id":"0000000","idx":25,"name":"Delivery L3","nvalue":0,"stype":"Electric","svalue1":"1710.0","unit":6}
{"Battery":255,"RSSI":12,"description":"","dtype":"Usage","id":"0000000","idx":24,"name":"Delivery L2","nvalue":0,"stype":"Electric","svalue1":"1443.0","unit":5}
{"Battery":255,"RSSI":12,"description":"","dtype":"Usage","id":"0000000","idx":23,"name":"Delivery L1","nvalue":0,"stype":"Electric","svalue1":"1726.0","unit":4}
Now i want to ad the three values from 'svalue1' together. In this case the result would be 1710+1443+1726 = 4879
Fist i tried to create a new function and retrack the svalues.
then is have this result.
{"n1":"1791.0"}
{"n2":"1637.0"}
{"n3":"1826.0"}
But now i am stuck with a nwe function to add up n1+n2+n3
I also tried the join node but that is giving me nothing at all..
This is what is have.
[{"id":"40635ad8.24fde4","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"78374b80.4fda64","type":"debug","z":"40635ad8.24fde4","name":"uitkomst","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":320,"y":40,"wires":},{"id":"52e4c849.3b2da8","type":"mqtt in","z":"40635ad8.24fde4","name":"","topic":"domoticz/out","qos":"2","datatype":"auto","broker":"b008ef44.96838","x":110,"y":60,"wires":[["78374b80.4fda64","136268c3.04fb97"]]},{"id":"c6bf5e01.5ef9e","type":"switch","z":"40635ad8.24fde4","name":"Delivery_P1","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"25","vt":"str"},{"t":"eq","v":"24","vt":"str"},{"t":"eq","v":"23","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":270,"y":200,"wires":[["b5470ea6.8e6db","77d414ed.945cdc","3dc25f8f.4fa3"],["b5470ea6.8e6db","77d414ed.945cdc","a0b0f3c6.09f3f"],["b5470ea6.8e6db","77d414ed.945cdc","1028c61c.0d6c5a"]]},{"id":"1028c61c.0d6c5a","type":"function","z":"40635ad8.24fde4","name":"IDX25","func":"msg.payload = {\n "n3":msg.payload.svalue1,\n};\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":140,"wires":[["19eb6d4.7f9ab93","27b742d8.030f7e"]]},{"id":"27b742d8.030f7e","type":"debug","z":"40635ad8.24fde4","name":"123","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":650,"y":220,"wires":},{"id":"a0b0f3c6.09f3f","type":"function","z":"40635ad8.24fde4","name":"IDX24","func":"msg.payload = {\n "n2":msg.payload.svalue1,\n};\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":100,"wires":[["19eb6d4.7f9ab93","27b742d8.030f7e"]]},{"id":"19eb6d4.7f9ab93","type":"function","z":"40635ad8.24fde4","name":"optellen","func":"msg.payload = \n\nmsg.payload.n1 + msg.payload.n2 + msg.payload.n3;\n\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":80,"wires":[]},{"id":"6c33bb30.de8c24","type":"debug","z":"40635ad8.24fde4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":280,"wires":},{"id":"3dc25f8f.4fa3","type":"function","z":"40635ad8.24fde4","name":"IDX23","func":"msg.payload = {\n "n1":msg.payload.svalue1,\n};\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":60,"wires":[["19eb6d4.7f9ab93","27b742d8.030f7e"]]},{"id":"b5470ea6.8e6db","type":"join","z":"40635ad8.24fde4","name":"opgeteld","mode":"custom","build":"object","property":"","propertyType":"full","key":"payload.svalue1","joiner":"\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":520,"y":260,"wires":[["6c33bb30.de8c24"]]},{"id":"77d414ed.945cdc","type":"debug","z":"40635ad8.24fde4","name":"#1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":500,"y":320,"wires":},{"id":"136268c3.04fb97","type":"json","z":"40635ad8.24fde4","name":"","property":"payload","action":"","pretty":false,"x":120,"y":160,"wires":[["c6bf5e01.5ef9e"]]},{"id":"b008ef44.96838","type":"mqtt-broker","z":"","name":"localhost","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]