Anyone know a way to do a dynamic (mqtt) specification subscriber topic specific? This not using # or + if the subscriber, at least I don't think so, I will xplain.
I want the subscriber to be specific, thus the flow to self-configurable on initial injection. You can do this with publisher topics, you can in a junction before the 'mqtt out' node, grab the host name, and create a static publisher that is host specific, for example, "//test" becames "/IamAhost/test" initial inject a flow initialization. This is because 'mqtt out' accepts an input. The flows I create, self configure, so I can import a flow, to any node-red instance, and avoid static assignments. So I don't have to use # or + qualifiers in subscribers, and parse the data received, unless that is exactly what is desired of course.
For 'mqtt in' states in its help notes that msg.topic if set will be honored, like in 'mqtt out', but I can't seem to get it to work. I think the documentation is wrong, or only really applies to 'mqtt out'.
Here is one way to self-configure a publisher...
[{"id":"b8757881.fcde68","type":"mqtt out","z":"1463b977.70bf97","name":"Pi4ModelB0 (/<Host>/revision","topic":"","qos":"","retain":"","broker":"98b1bc1f.465ac8","x":1390,"y":580,"wires":[]},{"id":"ddd8b49b.02c84","type":"function","z":"1463b977.70bf97","name":"Topic (/<Host>/revision)","func":"msg.topic = \"/\" + global.get('host') + \"/revision\";\nmsg.payload = msg.payload.toString().trim();\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1110,"y":580,"wires":[["b8757881.fcde68"]]},{"id":"98b1bc1f.465ac8","type":"mqtt-broker","z":"","name":"Pi4ModelB0","broker":"pi4modelb0.dachshund-digital.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
I want to do the same idea with a subscriber configuration...