Hello.
With other aswers here in the forum I solved my problem to make a sum of 2 MQTT values.
See here.
[{"id":"d10147cb.c374a8","type":"debug","z":"5f439c73.c516f4","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":210,"y":1600,"wires":[]},{"id":"3ffb9510.e6676a","type":"debug","z":"5f439c73.c516f4","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":790,"y":1600,"wires":[]},{"id":"6a97942.8839a6c","type":"mqtt in","z":"5f439c73.c516f4","name":"","topic":"solpiplog/pip/acoutw","qos":"0","datatype":"utf8","broker":"d891a2dc.5ed99","x":150,"y":1500,"wires":[["d10147cb.c374a8","acd6cb66.c99968","62946698.9563f8"]]},{"id":"650d067a.4787f8","type":"mqtt in","z":"5f439c73.c516f4","name":"","topic":"solpiplog2/pip/acoutw","qos":"0","datatype":"utf8","broker":"d891a2dc.5ed99","x":760,"y":1500,"wires":[["3ffb9510.e6676a","ae502b60.0a2a48"]]},{"id":"276bc209.1a5b9e","type":"change","z":"5f439c73.c516f4","name":"","rules":[{"t":"set","p":"A","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":1640,"wires":[["718d2102.205ea"]]},{"id":"718d2102.205ea","type":"change","z":"5f439c73.c516f4","name":"sum","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('A')+$flowContext('B')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1390,"y":1660,"wires":[["87c2a3a2.c114e"]]},{"id":"87c2a3a2.c114e","type":"debug","z":"5f439c73.c516f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","statusVal":"payload","statusType":"auto","x":1570,"y":1660,"wires":[]},{"id":"b5029a86.e5c3a8","type":"change","z":"5f439c73.c516f4","name":"","rules":[{"t":"set","p":"B","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":1680,"wires":[["718d2102.205ea"]]},{"id":"62946698.9563f8","type":"function","z":"5f439c73.c516f4","name":"string to number","func":"msg.payload = Number(msg.payload)\nmsg.topic = \"A\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":1640,"wires":[["276bc209.1a5b9e"]]},{"id":"ae502b60.0a2a48","type":"function","z":"5f439c73.c516f4","name":"string to number","func":"msg.payload = Number(msg.payload)\nmsg.topic = \"B\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":1680,"wires":[["b5029a86.e5c3a8"]]},{"id":"d891a2dc.5ed99","type":"mqtt-broker","name":"raspberri","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
The MQTT values are so included:
Server (is clear - the Raspberry)
Topic: solpiplog2/pip/acoutw
QoS = 0
Output a String
So I changed with the function from string to number.
My question is now: what is the backgound in the function node msg.topic = A
Then the cange node set: flow.A to msg.payload
So now my question:
solpiplog/pip/acoutw is the topic from MQTT. In the function node there is set a "new?" msg.topic with A? But the flow is A?
I tried to make different sum from different MQTTs.But it doesn´t work. What should I change? Can somebody explain the flow, topic questions.
Thanks