Hi,
I am using node-red-node-pi-gpio nodes to control solid state relays, which is all working fine when I assign the pin through the gpio node.
I am wanting to assign the pin to use through msg.topic. The docs on the page say to use msg.topic = "pi/{pin number}"
So I am sending through msg.topic = "pi/37", but it does not use the pin.
In fact it always uses the design-assigned gpio pin and not the pin assigned through msg.topic
12 Nov 08:22:52 - [info] Node-RED version: v1.2.3
12 Nov 08:22:52 - [info] Node.js version: v12.19.0
12 Nov 08:22:52 - [info] Linux 4.19.66-v7+ arm LE
Ant other details required?
Function code:
msg.topic = "pi/37";
node.log(msg.payload);
node.log(msg.topic);
return msg;
Flow below
[{"id":"c80ffb9b.89eea8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"804f52d3.2aa85","type":"ui_switch","z":"c80ffb9b.89eea8","name":"","label":"MLT Pump Test","tooltip":"","group":"ea5e6691.a9d4b8","order":11,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":280,"y":200,"wires":[["69f28e7a.bbf69"]]},{"id":"d4af027b.d7f91","type":"rpi-gpio out","z":"c80ffb9b.89eea8","name":"MLT GPIO","pin":"32","set":true,"level":"0","freq":"","out":"out","x":690,"y":200,"wires":[]},{"id":"69f28e7a.bbf69","type":"function","z":"c80ffb9b.89eea8","name":"Control GPIO","func":"\nmsg.topic = \"pi/37\";\n\nnode.log(msg.payload);\nnode.log(msg.topic);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":200,"wires":[["d4af027b.d7f91"]]},{"id":"ea5e6691.a9d4b8","type":"ui_group","z":"","name":"MLT","tab":"1a3824a0.4dd3fb","order":3,"disp":true,"width":"6","collapse":false},{"id":"1a3824a0.4dd3fb","type":"ui_tab","z":"","name":"Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]