Hi All,
I wonder if someone can help me with a simple solution to my control loop. I have a series on values coming into my control loop and I want add the newest value to the last value. My idea was to set new value as a global but I can figure out how to add it to the previous?
I have created a simple flow of what I am trying to achieve. So basically if inject the value 5 into 'some kind of node' I want the value 5 to pass through it. Then say the next new value is 10 I want the message payload to be 15. Then if next new value was 100 I want the msg payload to bee 115 for example. Bit like a counter relay. Add new value to old.
[{"id":"66a95929.4357b8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"67e87232.3e560c","type":"inject","z":"66a95929.4357b8","name":"","topic":"","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":100,"wires":[["832c7dbb.7020d"]]},{"id":"19025231.6df0ce","type":"inject","z":"66a95929.4357b8","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":180,"wires":[["832c7dbb.7020d"]]},{"id":"c0beaf7c.e8a16","type":"inject","z":"66a95929.4357b8","name":"","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["832c7dbb.7020d"]]},{"id":"90e8f252.80601","type":"debug","z":"66a95929.4357b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":180,"wires":},{"id":"832c7dbb.7020d","type":"change","z":"66a95929.4357b8","name":"","rules":[{"t":"set","p":"1stnewpayloadnumber","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":180,"wires":[["90e8f252.80601"]]},{"id":"3018bcdd.ced2b4","type":"inject","z":"66a95929.4357b8","name":"","topic":"","payload":"newpayloadnumber","payloadType":"global","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":380,"wires":[["9f0152a3.b7883"]]},{"id":"9f0152a3.b7883","type":"debug","z":"66a95929.4357b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":380,"wires":}]
Any help would be much appreciated
Cheers
Gareth