So I’m new to this forum and rather new to Node-Red.
I’m struggling with the following..
I would likely subtract 2 functions. I have come quite far but now really get stuck.
The whole idea is to “ Input a function” and subtract a 2nd function..
This second function has now a “ random” input which I will replace by an input node once I get the subtract to work..
[{"id":"24b0f66.0f9d10a","type":"tab","label":"Flow 7","disabled":false,"info":""},{"id":"75f6918.86e68f","type":"inject","z":"24b0f66.0f9d10a","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":897.511962890625,"y":474.2009582519531,"wires":[["9a61246.54797d8"]]},{"id":"585bb5be.c60cfc","type":"inject","z":"24b0f66.0f9d10a","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Control","payload":"Open","payloadType":"str","x":917.511962890625,"y":554.2009582519531,"wires":[["6f428f17.9d8688"]]},{"id":"cd154dbb.c93a3","type":"inject","z":"24b0f66.0f9d10a","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Control","payload":"Close","payloadType":"str","x":937.511962890625,"y":594.2009582519531,"wires":[["6f428f17.9d8688"]]},{"id":"5525ef64.e97ec","type":"inject","z":"24b0f66.0f9d10a","name":"","props":[{"p":"payload"}],"repeat":"0.5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":897.511962890625,"y":634.2009582519531,"wires":[["6f428f17.9d8688"]]},{"id":"6f428f17.9d8688","type":"gate","z":"24b0f66.0f9d10a","name":"","controlTopic":"control","defaultState":"closed","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"x":1197.511962890625,"y":654.2009582519531,"wires":[["17a6e604.a0ccf2"]]},{"id":"9a61246.54797d8","type":"random","z":"24b0f66.0f9d10a","name":"","low":1,"high":"100","inte":"true","property":"Payload","x":1297.511962890625,"y":574.2009582519531,"wires":[["3c38f27d.68d4d6"]]},{"id":"3c38f27d.68d4d6","type":"function","z":"24b0f66.0f9d10a","name":"T1","func":"msg.topic=\"T1\";\nmsg.payload =(msg.payload)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1477.511962890625,"y":574.2009582519531,"wires":[["d4f07c2b.1956c8"]]},{"id":"17a6e604.a0ccf2","type":"counter","z":"24b0f66.0f9d10a","name":"","init":"0","step":"1","lower":null,"upper":"25","mode":"increment","outputs":2,"x":1397.511962890625,"y":674.2009582519531,"wires":[["6c5b8392.5c1f2c"],[]]},{"id":"fb5baefb.f5018","type":"function","z":"24b0f66.0f9d10a","name":"Reset Counter","func":"msg.reset=msg.payload\nreturn msg;","outputs":1,"noerr":0,"x":1257.511962890625,"y":774.2009582519531,"wires":[["17a6e604.a0ccf2"]]},{"id":"e514d501.97aee","type":"inject","z":"24b0f66.0f9d10a","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":1077.511962890625,"y":814.2009582519531,"wires":[["fb5baefb.f5018"]]},{"id":"6c5b8392.5c1f2c","type":"function","z":"24b0f66.0f9d10a","name":"T2","func":"msg.topic=\"T2\";\nmsg.payload = (msg.payload)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1637.511962890625,"y":814.2009582519531,"wires":[["d4f07c2b.1956c8"]]},{"id":"d4f07c2b.1956c8","type":"join","z":"24b0f66.0f9d10a","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1897.511962890625,"y":774.2009582519531,"wires":[["47026e9a.c4fcb8"]]},{"id":"47026e9a.c4fcb8","type":"function","z":"24b0f66.0f9d10a","name":"Subtraction","func":"val1 = msg.T2\nval2 = msg.T1\n\nmsg.payload = val1 - val2;\nmsg.topic = \"Number\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1897.511962890625,"y":594.2009582519531,"wires":[["e65c48dc.c27b18"]]},{"id":"e65c48dc.c27b18","type":"debug","z":"24b0f66.0f9d10a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2077.511962890625,"y":654.2009582519531,"wires":[]}]
What am I doing wrong? I think it is in the subtract or join node..