Problem:
Incoming message:
rgb,x,r,g,b
limits:
x
0 - 7
r
,g
,b
0 - 255
This is the base flow:
[{"id":"33f88dd62e9a1854","type":"string","z":"65c9b63cb09879a0","name":"","methods":[{"name":"delLeftMost","params":[{"type":"str","value":"rgb,"}]},{"name":"left","params":[{"type":"num","value":"1"}]},{"name":"toInteger","params":[]}],"prop":"payload","propout":"pointer","object":"msg","objectout":"msg","x":2770,"y":160,"wires":[["9e72ba1e6e745ccf","d72327bb.0bc37"]]},{"id":"349b67738dfc8261","type":"inject","z":"65c9b63cb09879a0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"rgb,4,0,0,0","payloadType":"str","x":2610,"y":160,"wires":[["33f88dd62e9a1854"]]},{"id":"9e72ba1e6e745ccf","type":"debug","z":"65c9b63cb09879a0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"pointer","targetType":"msg","statusVal":"payload","statusType":"auto","x":2960,"y":160,"wires":[]},{"id":"d72327bb.0bc37","type":"string","z":"65c9b63cb09879a0","name":"0","methods":[{"name":"chompLeft","params":[{"type":"str","value":"rgb,4,"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":2810,"y":220,"wires":[["ee603826871cfe95"]]},{"id":"ee603826871cfe95","type":"function","z":"65c9b63cb09879a0","name":"","func":"let pointer = msg.pointer;\n\n\nflow.set(\"test[\"+pointer+\"]\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2980,"y":220,"wires":[[]]}]
Needed:
To not need 8 nodes, I want to set an array depending on the RGB values.
Look in the function
node.
let pointer = msg.pointer;
flow.set("test["+pointer+"]",msg.payload);
Doesn't work.
I need to get the second string
node to remove the first 6 characters.
For reasons unknown I am at a loss what command (option?) I need to use in the string node.