Hello,
So I'm having a somewhat weird issue that I was looking to get some light shed upon.
Background: I'm using roughly 50 MQTT output nodes that I would like to keep generic. Instead of changing them each individually, I have created one MQTT input node where the topic is changed for all nodes. On an older version of Node red, this worked no problem. Recently, I decided to upgrade to 0.20.7, which broke this system. I receive nothing on the input node, no matter what output type I choose. I also have lost my UTCms coming from Mosquitto.
Logic: User changes topic directory for mqtt input. Once updated, the new msg.topic is saved globally to be used as the first half of the generic topics. Not the best method, but it was the only way to do the method I could think of.
So my question is, how do I resolve this issue? Is there a way to downgrade mqtt nodes to the previous revision? I couldn't find updated documentation on the new mqtt nodes either. Below is an rough example of what I'm doing. Any information helps.
[{"id":"3f1df91a.5a1ba6","type":"function","z":"cf638576.00dcd8","name":"set global topics","func":"/*not the correct length for the substring, \nbut the idea is there*/\nvar mqtttopic = msg.topic.substring(0,16); \nvar mqtt_ig = msg.topic.substring(9,15); \n\nmqtt_ig = mqtt_ig+'_ig'; \n\nglobal.set('mqtt_ig', mqtt_ig); \nglobal.set('mqtttopic', mqtttopic); \n\nreturn msg;","outputs":1,"noerr":0,"x":468,"y":409,"wires":[["a7a63b7.f47bbc8"]]},{"id":"ee188903.9223b8","type":"mqtt in","z":"cf638576.00dcd8","name":"","topic":"Location/thing/machineID/Connection","qos":"2","datatype":"json","broker":"408486c8.28f7e8","x":192,"y":409,"wires":[["3f1df91a.5a1ba6","4e73565b.532ca8"]]},{"id":"a7a63b7.f47bbc8","type":"debug","z":"cf638576.00dcd8","name":"","active":true,"console":"false","complete":"true","x":635,"y":413,"wires":[]},{"id":"350a3339.ac8d9c","type":"mqtt in","z":"cf638576.00dcd8","name":"","topic":"#","qos":"2","datatype":"json","broker":"408486c8.28f7e8","x":104.5,"y":251,"wires":[["4e73565b.532ca8"]]},{"id":"4e73565b.532ca8","type":"debug","z":"cf638576.00dcd8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":454.5,"y":243,"wires":[]},{"id":"200bfd2c.f555c2","type":"function","z":"cf638576.00dcd8","name":"MQTT Configuration","func":"var mqtttopic = global.get('mqtttopic'); \n\nmsg.topic = mqtttopic+'/The rest of the topic tree'; \n\nreturn msg; ","outputs":1,"noerr":0,"x":364,"y":528,"wires":[["33e2de0b.602e32"]]},{"id":"33e2de0b.602e32","type":"mqtt out","z":"cf638576.00dcd8","name":"","topic":"","qos":"1","retain":"true","broker":"408486c8.28f7e8","x":552,"y":526,"wires":[]},{"id":"19c8878f.344608","type":"inject","z":"cf638576.00dcd8","name":"","topic":"","payload":"Test","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":88,"y":528,"wires":[["200bfd2c.f555c2"]]},{"id":"25da2239.ca914e","type":"comment","z":"cf638576.00dcd8","name":"There's 50 of these guys.^","info":"","x":289,"y":589,"wires":[]},{"id":"5008657a.f3aeec","type":"comment","z":"cf638576.00dcd8","name":"User changes this topic.^","info":"","x":159,"y":456,"wires":[]},{"id":"abb247fe.5240e8","type":"comment","z":"cf638576.00dcd8","name":"Troubleshooting topic^","info":"","x":120,"y":309,"wires":[]},{"id":"408486c8.28f7e8","type":"mqtt-broker","z":"","name":"","broker":"10.230.27.28","port":"1883","tls":"","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"Location/thing/machineID/Connection","birthQos":"2","birthRetain":"true","birthPayload":"Connected ","closeTopic":"Location/thing/machineID/Connection","closeQos":"2","closeRetain":"true","closePayload":"Disconnected","willTopic":"Location/thing/machineID/Connection","willQos":"2","willRetain":"true","willPayload":"Disconnected"}]```