Announcement

Collapse
No announcement yet.

Subscribe to topics from multiple MQTT brokers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Subscribe to topics from multiple MQTT brokers

    I already have mcsMQTT subscribing to a Mosquitto broker running on my local network. Can I also connect to to a second MQTT broker, and subscribe to topics from this server as well? If not, how can I get around this, so I end up with devices in HS3 with data from two different MQTT brokers?

    Have googled this for a while now, but have come up empty.

  • #2
    Ah, I just saw that Mosquitto support broker bridging, subscribing to messages from another MQTT broker. Time to investigate...

    Comment


    • #3
      I implemented multiple brokers and now testing. If it works out it will be another option for you.

      Comment


      • #4
        Completed testing and update available at http://mcsSprinklers.com/mcsMQTT_4_1_7_0.zip. Section 4.1.28 contains a full description. The primary thing needed to enable the other brokers is on the General Tab, MQTT Broker Operations by adding a semicolon and then the second broker address as shown below. mcsMQTT will keep track of the broker routing for each topic.

        Click image for larger version

Name:	Capture2.PNG
Views:	38
Size:	34.2 KB
ID:	1326558

        Comment


        • #5
          I missed provisions for the broker connect/disconnect event trigger for the additional brokers. It is fixed in http://mcsSprinklers.com/mcsMQTT_4_1_7_1.zip.

          Comment


          • #6
            Great work! I'll test it out. But how can I control broker username and password? "user1;user2" and "pass1;pass2"? And if e.g. first server doesn't use a username and password but the second does, can I just enter username like ";user2" and password like ";pass2"?

            Comment


            • #7
              It is described in Section 4.1.28 in the manual. In essence you separate each with semicolon. The syntax of ";pw" for case of no password on first and pw on the second. I did not setup a broker with username, password or SSL so these are untested, but they all follow the pattern of the broker name in the code so should work fine.

              Comment

              Working...
              X