[{"id":"c60b2dd0aed70159","type":"mqtt out","z":"fec3a58f1cc8836e","name":"","topic":"RGL/221600001/up","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"846ddbe9b23fde48","x":670,"y":360,"wires":[]},{"id":"8c191eacea8dd2f2","type":"mqtt in","z":"fec3a58f1cc8836e","name":"dynamic subscription MQTT","topic":"","qos":"1","datatype":"auto-detect","broker":"846ddbe9b23fde48","nl":false,"rap":true,"rh":0,"inputs":1,"x":580,"y":140,"wires":[["03b125f38db1c6f4"]]},{"id":"03b125f38db1c6f4","type":"debug","z":"fec3a58f1cc8836e","name":"dynamic topic","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"topic","targetType":"msg","statusVal":"topic","statusType":"auto","x":840,"y":140,"wires":[]},{"id":"d1a42c96ed235cb1","type":"function","z":"fec3a58f1cc8836e","name":"action & topic","func":"msg.action =\"subscribe\"\nmsg.topic = \"RGL/\" + msg.payload + \"/up\"\nnode.status({\"text\":msg.topic})\n return msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":140,"wires":[["8c191eacea8dd2f2"]]},{"id":"ba6c3d52cef8d2f6","type":"inject","z":"fec3a58f1cc8836e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":350,"y":430,"wires":[["da099b394c632927"]]},{"id":"0d927d795af07a55","type":"inject","z":"fec3a58f1cc8836e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":350,"y":360,"wires":[["c60b2dd0aed70159"]]},{"id":"398aca50be6d61c6","type":"inject","z":"fec3a58f1cc8836e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"0.5","topic":"","payload":"221600001","payloadType":"num","x":100,"y":120,"wires":[["d1a42c96ed235cb1"]]},{"id":"da099b394c632927","type":"mqtt out","z":"fec3a58f1cc8836e","name":"","topic":"RGL/221600002/up","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"846ddbe9b23fde48","x":670,"y":430,"wires":[]},{"id":"819f147d2179740f","type":"inject","z":"fec3a58f1cc8836e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"0.5","topic":"","payload":"221600002","payloadType":"num","x":100,"y":210,"wires":[["d1a42c96ed235cb1"]]},{"id":"90fb576b4ef7da9a","type":"comment","z":"fec3a58f1cc8836e","name":"1st device talk","info":"","x":410,"y":390,"wires":[]},{"id":"f45b2e4a6a2d8204","type":"comment","z":"fec3a58f1cc8836e","name":"2nd device talk","info":"","x":420,"y":460,"wires":[]},{"id":"cd0e9e9d4960b35c","type":"comment","z":"fec3a58f1cc8836e","name":"listen 1st device","info":"","x":120,"y":150,"wires":[]},{"id":"c1394791b6bcdd8a","type":"comment","z":"fec3a58f1cc8836e","name":"listen 2nd device","info":"","x":120,"y":240,"wires":[]},{"id":"5daf788c232f5492","type":"mqtt in","z":"fec3a58f1cc8836e","name":"","topic":"RGL/221600001/up","qos":"1","datatype":"auto-detect","broker":"846ddbe9b23fde48","nl":false,"rap":true,"rh":0,"inputs":0,"x":550,"y":230,"wires":[["80dad9e0d6a9878b"]]},{"id":"80dad9e0d6a9878b","type":"debug","z":"fec3a58f1cc8836e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"topic","targetType":"msg","statusVal":"topic","statusType":"auto","x":820,"y":230,"wires":[]},{"id":"846ddbe9b23fde48","type":"mqtt-broker","name":"","broker":"192.168.0.58","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
hello all,
I am trying to read messages from 2 different devices. Each has its topic to differentiate the data.
On the MQTT receiver, I dynamically change the topic to only receive messages from one device BUT if the 2nd device "speaks" I also receive its data?
When I "subscribe to single topic" in the receiver, the 2nd device is not received. It is indeed a problem of the topic dynamic.
Did I do it wrong or is there a bug in the MQTT node?
(NR v3.0.2)