How to apply "Switch case"

The flow that I am developing begins by receiving test data (measurements) in a function node to save them in different flow variables, it is later when I have the problem.

I use a function node to process the variables (measurements) with an equation that later the result is saved in another variable flow.

In that equation, only one variable changes according to the situation, therefore I use a "Switch" to be able to separate the cases according to the variable that differs in the equation, but it does not display more than the first case, therefore they are not saved the results of the equations in flow variables.

I hope someone can help me to display all the results of the cases, but more importantly, that if the results of the equations are saved in flow variables.

Thanks for your time.

Flow:

[{"id":"ba4335fa.b30fc8","type":"tab","label":"Caracteristica MHO - Rele de distancia","disabled":false,"info":""},{"id":"f99252a3.e7d68","type":"inject","z":"ba4335fa.b30fc8","name":"Multiplicador de Voltaje","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"MV","payload":"1","payloadType":"num","x":250,"y":920,"wires":[["4c7ed37f.d3d61c"]]},{"id":"7df00391.99b8dc","type":"inject","z":"ba4335fa.b30fc8","name":"Multiplicador de corriente","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"MC","payload":"1","payloadType":"num","x":260,"y":960,"wires":[["4c7ed37f.d3d61c"]]},{"id":"ae0ab455.2343d8","type":"inject","z":"ba4335fa.b30fc8","name":"Voltaje aplicado al relé","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"Vap","payload":"31.003","payloadType":"num","x":250,"y":1000,"wires":[["4c7ed37f.d3d61c"]]},{"id":"6e1fd385.08044c","type":"inject","z":"ba4335fa.b30fc8","name":"CP2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP2","payload":"5","payloadType":"num","x":190,"y":160,"wires":[["4c7ed37f.d3d61c"]]},{"id":"94789621.1cb928","type":"inject","z":"ba4335fa.b30fc8","name":"CP1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP1","payload":"5","payloadType":"num","x":190,"y":80,"wires":[["4c7ed37f.d3d61c"]]},{"id":"cd9ff92f.228ef8","type":"inject","z":"ba4335fa.b30fc8","name":"CP3","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP3","payload":"5","payloadType":"num","x":190,"y":240,"wires":[["4c7ed37f.d3d61c"]]},{"id":"32acc0d7.64597","type":"inject","z":"ba4335fa.b30fc8","name":"CP4","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP4","payload":"5","payloadType":"num","x":190,"y":320,"wires":[["4c7ed37f.d3d61c"]]},{"id":"e7a1c118.5ca8e","type":"inject","z":"ba4335fa.b30fc8","name":"CP5","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP5","payload":"5","payloadType":"num","x":190,"y":400,"wires":[["4c7ed37f.d3d61c"]]},{"id":"5a018fc9.c4003","type":"inject","z":"ba4335fa.b30fc8","name":"CP6","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP6","payload":"5","payloadType":"num","x":190,"y":480,"wires":[["4c7ed37f.d3d61c"]]},{"id":"6bd301ad.7a507","type":"inject","z":"ba4335fa.b30fc8","name":"CP7","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP7","payload":"5","payloadType":"num","x":190,"y":560,"wires":[["4c7ed37f.d3d61c"]]},{"id":"4b6826b.c3736d8","type":"inject","z":"ba4335fa.b30fc8","name":"CP8","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP8","payload":"5","payloadType":"num","x":190,"y":640,"wires":[["4c7ed37f.d3d61c"]]},{"id":"6bca3c09.f346b4","type":"inject","z":"ba4335fa.b30fc8","name":"CP9","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP9","payload":"5","payloadType":"num","x":190,"y":720,"wires":[["4c7ed37f.d3d61c"]]},{"id":"e857e30e.6e7db","type":"inject","z":"ba4335fa.b30fc8","name":"CP10","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"CP10","payload":"5","payloadType":"num","x":190,"y":800,"wires":[["4c7ed37f.d3d61c"]]},{"id":"4c7ed37f.d3d61c","type":"function","z":"ba4335fa.b30fc8","name":"Guardado de variables","func":"var CP1, CP2, CP3, CP4, CP5, CP6, CP7, CP8 ,CP9, CP10;\nvar C_oP1, C_oP2, C_oP3, C_oP4, C_oP5, C_oP6, C_oP7, C_oP8, C_oP9, C_oP10;\nvar Vap;\nvar MV;\nvar MC;\n\nswitch (msg.topic) {\n\n case 'Vap':           // Voltaje aplicado al relé\n Vap = msg.payload;\n flow.set(\"Vap\", Vap); \n return msg;\n\n//--------- CORRIENTES EN PUNTOS------------------------    \n case 'CP1':\n CP1 = msg.payload;\n flow.set(\"CP1\", CP1);\n return msg;\n \n case 'CP2':\n CP2 = msg.payload;\n flow.set(\"CP2\", CP2); \n return msg;\n \n case 'CP3':\n CP3 = msg.payload;\n flow.set(\"CP3\", CP3); \n return msg;\n \n case 'CP4':\n CP4 = msg.payload;\n flow.set(\"CP4\", CP4); \n return msg;\n \n case 'CP5':\n CP5 = msg.payload;\n flow.set(\"CP5\", CP5);\n return msg;\n \n case 'CP6':\n CP6 = msg.payload;\n flow.set(\"CP6\", CP6);\n return msg;\n \n case 'CP7':\n CP7 = msg.payload;\n flow.set(\"CP7\", CP7); \n return msg;\n \n case 'CP8':\n CP8 = msg.payload;\n flow.set(\"CP8\", CP8); \n return msg;\n \n case 'CP9':\n CP9 = msg.payload;\n flow.set(\"CP9\", CP9); \n return msg;\n \n case 'CP10':\n CP10 = msg.payload;\n flow.set(\"CP10\", CP10);\n return msg;\n \n//--------- ANGULOS DE CORRIENTES EN PUNTOS------------------------    \n case 'C°P1':\n C_oP1 = msg.payload;\n flow.set(\"C°P1\", C_oP1);\n return msg;\n \n case 'C°P2':\n C_oP2 = msg.payload;\n flow.set(\"C°P2\", C_oP2); \n return msg;\n \n case 'C°P3':\n C_oP3 = msg.payload;\n flow.set(\"C°P3\", C_oP3); \n return msg;\n \n case 'C°P4':\n C_oP4 = msg.payload;\n flow.set(\"C°P4\", C_oP4); \n return msg;\n \n case 'C°P5':\n C_oP5 = msg.payload;\n flow.set(\"C°P5\", C_oP5);\n return msg;\n \n case 'C°P6':\n C_oP6 = msg.payload;\n flow.set(\"C°P6\", C_oP6);\n return msg;\n \n case 'C°P7':\n C_oP7 = msg.payload;\n flow.set(\"C°P7\", C_oP7); \n return msg;\n \n case 'C°P8':\n C_oP8 = msg.payload;\n flow.set(\"CP8\", C_oP8); \n return msg;\n \n case 'C°P9':\n C_oP9 = msg.payload;\n flow.set(\"C°P9\", C_oP9); \n return msg;\n \n case 'C°P10':\n C_oP10 = msg.payload;\n flow.set(\"C°P10\", C_oP10);\n return msg;\n \n \n//--------- MULTIPLICADORES DE CORRIENTE Y VOLTAJE-------------\n\n case 'MV':\n MV = msg.payload;\n flow.set(\"MV\", MV); \n return msg;\n \n case 'MC':\n MC = msg.payload;\n flow.set(\"MC\", MC); \n return msg;\n \n break;\n \n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":380,"wires":[["89727f84.6c169","d6a5639d.9c1e1"]],"inputLabels":["Señales"],"outputLabels":["Señales en Vaiables"],"icon":"node-red-dashboard/ui_template.png"},{"id":"47c1e07a.d5656","type":"debug","z":"ba4335fa.b30fc8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":510,"y":460,"wires":[]},{"id":"89727f84.6c169","type":"rbe","z":"ba4335fa.b30fc8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":510,"y":420,"wires":[["47c1e07a.d5656"]]},{"id":"aba26650.295e78","type":"inject","z":"ba4335fa.b30fc8","name":"C°P2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P2","payload":"30","payloadType":"num","x":190,"y":200,"wires":[["4c7ed37f.d3d61c"]]},{"id":"da14a7e6.4567a8","type":"inject","z":"ba4335fa.b30fc8","name":"C°P1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P1","payload":"0","payloadType":"num","x":190,"y":120,"wires":[["4c7ed37f.d3d61c"]]},{"id":"5bac2e9.12bc8d","type":"inject","z":"ba4335fa.b30fc8","name":"C°P3","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P3","payload":"60","payloadType":"num","x":190,"y":280,"wires":[["4c7ed37f.d3d61c"]]},{"id":"53282119.b92f6","type":"inject","z":"ba4335fa.b30fc8","name":"C°P4","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P4","payload":"90","payloadType":"num","x":190,"y":360,"wires":[["4c7ed37f.d3d61c"]]},{"id":"b0b577cc.9ec948","type":"inject","z":"ba4335fa.b30fc8","name":"C°P5","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P5","payload":"120","payloadType":"num","x":190,"y":440,"wires":[["4c7ed37f.d3d61c"]]},{"id":"abd01090.ee9f3","type":"inject","z":"ba4335fa.b30fc8","name":"C°P6","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P6","payload":"150","payloadType":"num","x":190,"y":520,"wires":[["4c7ed37f.d3d61c"]]},{"id":"81615134.87169","type":"inject","z":"ba4335fa.b30fc8","name":"C°P7","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P7","payload":"180","payloadType":"num","x":190,"y":600,"wires":[["4c7ed37f.d3d61c"]]},{"id":"f03845b5.21ea88","type":"inject","z":"ba4335fa.b30fc8","name":"C°P8","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P8","payload":"210","payloadType":"num","x":190,"y":680,"wires":[["4c7ed37f.d3d61c"]]},{"id":"5e778a5e.fed504","type":"inject","z":"ba4335fa.b30fc8","name":"C°P9","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P9","payload":"240","payloadType":"num","x":190,"y":760,"wires":[["4c7ed37f.d3d61c"]]},{"id":"96afa872.29b1a8","type":"inject","z":"ba4335fa.b30fc8","name":"C°P10","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P10","payload":"270","payloadType":"num","x":200,"y":840,"wires":[["4c7ed37f.d3d61c"]]},{"id":"ed1e847e.48ac78","type":"comment","z":"ba4335fa.b30fc8","name":"Corrientes en Puntos de prueba","info":"","x":250,"y":40,"wires":[]},{"id":"32174df5.b49f32","type":"comment","z":"ba4335fa.b30fc8","name":"Voltaje y multiplicadores","info":"","x":220,"y":880,"wires":[]},{"id":"d6a5639d.9c1e1","type":"function","z":"ba4335fa.b30fc8","name":"ZP1 - ZP10","func":"var MV = flow.get(\"MV\");\nvar MC = flow.get(\"MC\");\nvar Vap = flow.get(\"Vap\");\nvar CP1 = flow.get(\"CP1\");\nvar CP2 = flow.get(\"CP2\");\nvar CP3 = flow.get(\"CP3\");\nvar CP4 = flow.get(\"CP4\");\nvar CP5 = flow.get(\"CP5\");\nvar CP6 = flow.get(\"CP6\");\nvar CP7 = flow.get(\"CP7\");\nvar CP8 = flow.get(\"CP8\");\nvar CP9 = flow.get(\"CP9\");\nvar CP10 = flow.get(\"CP10\");\nvar CP;\n\nswitch (MV != null && MC != null && Vap != null && CP != null) {\n \n case (CP == CP1):\n var resultP1 = ((MV * Vap) / (MC * CP1));\n flow.set(\"ZP1\", resultP1);\n msg.payload = flow.get(\"ZP1\");\n msg.topic = \"ZP1\";\n return msg;\n \n case (CP == CP2):\n var resultP2 = ((MV * Vap) / (MC * CP2));\n flow.set(\"ZP2\", resultP2);\n msg.payload = flow.get(\"ZP2\");\n msg.topic = \"ZP2\";\n return msg;\n \n case (CP == CP3):\n var resultP3 = ((MV * Vap) / (MC * CP3));\n flow.set(\"ZP3\", resultP3);\n msg.payload = flow.get(\"ZP3\");\n msg.topic = \"ZP3\";\n return msg;\n \n case (CP == CP4):\n var resultP4 = ((MV * Vap) / (MC * CP4));\n flow.set(\"ZP4\", resultP4);\n msg.payload = flow.get(\"ZP4\");\n msg.topic = \"ZP4\";\n return msg;\n \n  case (CP == CP5):\n var resultP5 = ((MV * Vap) / (MC * CP5));\n flow.set(\"ZP5\", resultP5);\n msg.payload = flow.get(\"ZP5\");\n msg.topic = \"ZP5\";\n return msg;\n \n  case (CP == CP6):\n var resultP6 = ((MV * Vap) / (MC * CP6));\n flow.set(\"ZP6\", resultP6);\n msg.payload = flow.get(\"ZP6\");\n msg.topic = \"ZP6\";\n return msg;\n \n  case (CP == CP7):\n var resultP7 = ((MV * Vap) / (MC * CP7));\n flow.set(\"ZP7\", resultP7);\n msg.payload = flow.get(\"ZP7\");\n msg.topic = \"ZP7\";\n return msg;\n \n  case (CP == CP8):\n var resultP8 = ((MV * Vap) / (MC * CP8));\n flow.set(\"ZP8\", resultP8);\n msg.payload = flow.get(\"ZP8\");\n msg.topic = \"ZP8\";\n return msg;\n \n  case (CP == CP9):\n var resultP9 = ((MV * Vap) / (MC * CP9));\n flow.set(\"ZP9\", resultP9);\n msg.payload = flow.get(\"ZP9\");\n msg.topic = \"ZP9\";\n return msg;\n \n  case (CP == CP10):\n var resultP10 = ((MV * Vap) / (MC * CP10));\n flow.set(\"ZP10\", resultP10);\n msg.payload = flow.get(\"ZP10\");\n msg.topic = \"ZP10\";\n return msg;\n \n break;\n \n}\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":380,"wires":[["456aefbb.a163"]]},{"id":"456aefbb.a163","type":"rbe","z":"ba4335fa.b30fc8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":750,"y":420,"wires":[["ef2929a7.5e0f98"]]},{"id":"ef2929a7.5e0f98","type":"debug","z":"ba4335fa.b30fc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":750,"y":460,"wires":[]}]

Looking at your second function, CP has no value, but you are using it to compare to CP1 - 10 so there can be no match. What should CP value be?

1 Like

The variable CP is the variable that I use to differentiate a variable in the equation according to the case (CP1 - CP10), it has no value because I compare it with the variable that varies in the equation, for example:
CP === CP1 (equation case 1)

In this way, it does display the value of the first equation, that is, the comparison is performed well, but it does not display the other cases.

var CP1 = flow.get("CP1");
var CP;

from your second function cp has no value

so cp === cp1 is undefined === 5 which is false and will be for all your values as CP has no value in your code

so switch (MV != null && MC != null && Vap != null && CP != null) evaluates to false

and CP ===CP1 evaluates to false

so case 1 === switch (MV != null && MC != null && Vap != null && CP != null)
so only the firat case matches as both the switch expression and case1 equal false.

1 Like

So, how can i do to compare just the string value? because i am not trying to compare a number value, just the name of the variable. kind of:

"cp" === "cp1"

i tried it, but it does not work anyway.

What string value? you have not given CP a value. I am still wondering what you are trying to compare.
Sorry but you will need to give clear example of what you are attempting to compare.

1 Like

I will try to explain as best I can, since I am new to node-red as you can see.

I have an equation: ((MV * Vap) / (MC * X))
Within the equation the variable "X" actually goes CP1, CP2 and so on until CP10.

ZP1 = ((MV * Vap) / (MC * CP1));
ZP2 = ((MV * Vap) / (MC * CP2));
....
ZP10 = ((MV * Vap) / (MC * CP10));

That's what I need to do, replace the variable in the equation, but saving the results in flow variables, at the same time that I display the value.

I did it with switch because with "If" I did not succeed either.

Try this

[{"id":"d6a5639d.9c1e1","type":"function","z":"ba4335fa.b30fc8","name":"ZP1 - ZP10","func":"var values = flow.get(\"values\");\nvar i = msg.topic.split(/(\\d+)/);\n\n\nif (values.MV != null && values.MC != null && values.Vap != null && values[msg.topic] && i[0] == \"CP\") {\n    msg.payload = ((values.MV * values.Vap) / (values.MC * values[msg.topic]));\n    flow.set(\"results.ZP\"+i[1], msg.payload);\n    msg.topic = \"ZP\"+i[1];\n    return msg;\n        \n}else{\nreturn null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":720,"y":360,"wires":[["456aefbb.a163","c3201207.924938"]]},{"id":"4c7ed37f.d3d61c","type":"function","z":"ba4335fa.b30fc8","name":"Guardado de variables","func":"if(msg.topic.match(/^(C.*P\\d+|MC|MV|Vap)$/) && !isNaN(msg.payload)){\n    flow.set(\"values.\"+msg.topic, msg.payload); \n    return msg;\n}else{\n    return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":480,"y":360,"wires":[["a5d199d8.91bfe8","d6a5639d.9c1e1"]],"inputLabels":["Señales"],"outputLabels":["Señales en Vaiables"],"icon":"node-red-dashboard/ui_template.png"},{"id":"456aefbb.a163","type":"rbe","z":"ba4335fa.b30fc8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":753.0000152587891,"y":427,"wires":[["ef2929a7.5e0f98"]]},{"id":"c3201207.924938","type":"debug","z":"ba4335fa.b30fc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":780,"y":300,"wires":[]},{"id":"f99252a3.e7d68","type":"inject","z":"ba4335fa.b30fc8","name":"Multiplicador de Voltaje","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"MV","payload":"1","payloadType":"num","x":243.00001525878906,"y":927,"wires":[["4c7ed37f.d3d61c"]]},{"id":"7df00391.99b8dc","type":"inject","z":"ba4335fa.b30fc8","name":"Multiplicador de corriente","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"MC","payload":"1","payloadType":"num","x":253.00001525878906,"y":967,"wires":[["4c7ed37f.d3d61c"]]},{"id":"ae0ab455.2343d8","type":"inject","z":"ba4335fa.b30fc8","name":"Voltaje aplicado al relé","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Vap","payload":"31.003","payloadType":"num","x":243.00001525878906,"y":1007,"wires":[["4c7ed37f.d3d61c"]]},{"id":"6bca3c09.f346b4","type":"inject","z":"ba4335fa.b30fc8","name":"CP9","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP9","payload":"5","payloadType":"num","x":183.00001525878906,"y":727,"wires":[["4c7ed37f.d3d61c"]]},{"id":"e857e30e.6e7db","type":"inject","z":"ba4335fa.b30fc8","name":"CP10","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP10","payload":"5","payloadType":"num","x":183.00001525878906,"y":807,"wires":[["4c7ed37f.d3d61c"]]},{"id":"a5d199d8.91bfe8","type":"rbe","z":"ba4335fa.b30fc8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":500,"y":420,"wires":[["47c1e07a.d5656"]]},{"id":"5e778a5e.fed504","type":"inject","z":"ba4335fa.b30fc8","name":"C°P9","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P9","payload":"240","payloadType":"num","x":183.00001525878906,"y":767,"wires":[["4c7ed37f.d3d61c"]]},{"id":"96afa872.29b1a8","type":"inject","z":"ba4335fa.b30fc8","name":"C°P10","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P10","payload":"270","payloadType":"num","x":193.00001525878906,"y":847,"wires":[["4c7ed37f.d3d61c"]]},{"id":"34533ed5.07c862","type":"inject","z":"ba4335fa.b30fc8","name":"CP1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP1","payload":"5","payloadType":"num","x":150,"y":80,"wires":[["4c7ed37f.d3d61c"]]},{"id":"891d05e3.1e0288","type":"inject","z":"ba4335fa.b30fc8","name":"C°P1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P1","payload":"0","payloadType":"num","x":150,"y":120,"wires":[["4c7ed37f.d3d61c"]]},{"id":"c100085f.08f42","type":"inject","z":"ba4335fa.b30fc8","name":"CP2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP2","payload":"5","payloadType":"num","x":150,"y":160,"wires":[["4c7ed37f.d3d61c"]]},{"id":"499a4fee.d1f458","type":"inject","z":"ba4335fa.b30fc8","name":"C°P2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P2","payload":"30","payloadType":"num","x":160,"y":200,"wires":[["4c7ed37f.d3d61c"]]},{"id":"d64b2bb7.563f58","type":"inject","z":"ba4335fa.b30fc8","name":"CP3","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP3","payload":"5","payloadType":"num","x":160,"y":240,"wires":[["4c7ed37f.d3d61c"]]},{"id":"83c6e535.9033c8","type":"inject","z":"ba4335fa.b30fc8","name":"C°P3","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P3","payload":"60","payloadType":"num","x":160,"y":280,"wires":[["4c7ed37f.d3d61c"]]},{"id":"e86245b4.c87698","type":"inject","z":"ba4335fa.b30fc8","name":"CP4","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP4","payload":"5","payloadType":"num","x":160,"y":320,"wires":[["4c7ed37f.d3d61c"]]},{"id":"dda6816f.7b415","type":"inject","z":"ba4335fa.b30fc8","name":"C°P4","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P4","payload":"90","payloadType":"num","x":160,"y":360,"wires":[["4c7ed37f.d3d61c"]]},{"id":"4cab588d.ce1ff8","type":"inject","z":"ba4335fa.b30fc8","name":"CP5","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP5","payload":"5","payloadType":"num","x":160,"y":400,"wires":[["4c7ed37f.d3d61c"]]},{"id":"c89a2f10.0cd1e","type":"inject","z":"ba4335fa.b30fc8","name":"C°P5","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P5","payload":"120","payloadType":"num","x":160,"y":440,"wires":[["4c7ed37f.d3d61c"]]},{"id":"c7ad4c9d.e88e8","type":"inject","z":"ba4335fa.b30fc8","name":"CP6","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP6","payload":"5","payloadType":"num","x":160,"y":480,"wires":[["4c7ed37f.d3d61c"]]},{"id":"83c17606.38f22","type":"inject","z":"ba4335fa.b30fc8","name":"C°P6","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P6","payload":"150","payloadType":"num","x":160,"y":520,"wires":[["4c7ed37f.d3d61c"]]},{"id":"6faf7c20.e2a1b4","type":"inject","z":"ba4335fa.b30fc8","name":"CP7","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP7","payload":"5","payloadType":"num","x":160,"y":560,"wires":[["4c7ed37f.d3d61c"]]},{"id":"e7fe054c.b9618","type":"inject","z":"ba4335fa.b30fc8","name":"C°P7","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P7","payload":"180","payloadType":"num","x":160,"y":600,"wires":[["4c7ed37f.d3d61c"]]},{"id":"45402e90.9b6988","type":"inject","z":"ba4335fa.b30fc8","name":"CP8","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CP8","payload":"5","payloadType":"num","x":160,"y":640,"wires":[["4c7ed37f.d3d61c"]]},{"id":"85e3e8c2.163dd","type":"inject","z":"ba4335fa.b30fc8","name":"C°P8","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"C°P8","payload":"210","payloadType":"num","x":160,"y":680,"wires":[["4c7ed37f.d3d61c"]]},{"id":"ef2929a7.5e0f98","type":"debug","z":"ba4335fa.b30fc8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":753.0000152587891,"y":467,"wires":[]},{"id":"47c1e07a.d5656","type":"debug","z":"ba4335fa.b30fc8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":513.0000152587891,"y":467,"wires":[]}]

I also set your flow context into a single property, it makes it easier to delete and manage, the zp1 i put in another property.

P.S. never have that many injects set to auto inject as it is a pain for anyone trying your flow, best let others set the inject options.

1 Like