Sorry folks, but I can't understand it.
I did a quick search but am not wording it the right way.
This is an example of what I am wanting to do.
[{"id":"5869e9f6.3f1a3","type":"function","z":"675e227d.d158b4","name":"","func":"msg1 = {};\n\n\nlet x = context.get(\"STATE\") || 0;\n\nx = (x + 1) % 2;\ncontext.set(\"STATE\",x);\n\nif (x === 0)\n{\n //\n // Set things for state 0\n //\n msg.payload = context.get(\"PayloadA\");\n msg.topic = context.get(\"Topic\");\n msg1.colour = context.get(\"ABGC\");\n msg1.txt = context.get(\"Atxt\");\n msg1.fontclr = context.get(\"AFC\");\n}\nelse if (x === 1)\n{\n //\n // Set things for state 1\n //\n msg.payload = context.get(\"PayloadB\");\n msg.topic = context.get(\"Topic\");\n msg1.colour = context.get(\"BBGC\");\n msg1.txt = context.get(\"Btxt\");\n msg1.fontclr = context.get(\"BFC\");\n}\n\n\n\n\n\nreturn msg;","outputs":2,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nlet topic = \"CONTROL\";\nlet PayloadA = \"ON\";\nlet ABGC = \"blue\";\nlet Atxt = \"On\";\nlet AFC = \"black\";\n","finalize":"","libs":[],"x":420,"y":2510,"wires":[["2d39686e.02fac8"],[]]}]
Look in the on start
tab.
Yeah, I am missing half of them, but if I am shown how to do the first half, I hope I can then do the second half.
Ok, progress made, but still not there.
[{"id":"5869e9f6.3f1a3","type":"function","z":"675e227d.d158b4","name":"","func":"msg1 = {};\n\n\nlet x = context.get(\"STATE\") || 0;\n\nx = (x + 1) % 2;\ncontext.set(\"STATE\",x);\n\nif (x === 0)\n{\n //\n // Set things for state 0\n //\n msg.payload = context.get(\"PayloadA\");\n msg.topic = context.get(\"Topic\");\n msg1.colour = context.get(\"ABGC\");\n msg1.txt = context.get(\"Atxt\");\n msg1.fontclr = context.get(\"AFC\");\n}\nelse if (x === 1)\n{\n //\n // Set things for state 1\n //\n msg.payload = context.get(\"PayloadB\");\n msg.topic = context.get(\"Topic\");\n msg1.colour = context.get(\"BBGC\");\n msg1.txt = context.get(\"Btxt\");\n msg1.fontclr = context.get(\"BFC\");\n}\n\n\n\n\n\nreturn msg;","outputs":2,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\ncontext.set(\"topic\",\"CONTROL\");\ncontext.set(\"PayloadA\",\"ON\");\ncontext.set(\"AGBC\",\"blue\");\ncontext.set(\"Atxt\",\"On\");\ncontexet.set(\"AFC\",\"black\");\n\ncontext.set(\"PayloadB\",\"OFF\");\ncontext.set(\"BGBC\",\"yellow\");\ncontext.set(\"Btxt\",\"Off\");\ncontexet.set(\"BFC\",\"white\");\n","finalize":"","libs":[],"x":420,"y":2510,"wires":[["2d39686e.02fac8"],[]]}]
I am not seeing the second half being set.
Ok, bad spelling in the context.set
line... Yeah?