Hi everyone !
Is there a way to change de MQTT host / IP during runtime like the TCP node with msg.host and msg.port?
I need to be able to communication with a lot of node-red instances on different locations using MQTT and I don't want to hardcode all the different IP since all these IP are available in my SQL Database.
Thank you very much !
so have one broker and use a bunch of different topics
pi1 pub/sub's using topic: pi1/something
pi2 pub/sub's using topic: pi2/something
the can both use the same broker
2 Likes
Perhaps you don't quite understand the role of MQTT?
As @zenofmud said, use topics. This way, all of your node-red installations can intercommunicate and IP is irrelevant.
You could even build a topic from the DB like data/ip/name
Then you can subscribe to all messages from 1 IP...
data/ip/#
Or subscribe to all certain values for all IPs
data/#/size
Thank you very much for the replies guys, I will use a centralized broker for the communication between all the node-red instances it will certainly do the job. Have a nice day !