Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. OpenHAB
  4. MQTT Binging - Possible two MQTT broker?

MQTT Binging - Possible two MQTT broker?

Scheduled Pinned Locked Moved OpenHAB
10 Posts 2 Posters 3.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xefil
    wrote on last edited by
    #1

    Hello to all!
    I'm using OpenHAB with an arduino network powered by mysensors.org project.
    OpenHAB is working well using a MQTT connection to this arduino gateway. Until here all works fine.
    I would like to add a second MQTT broker on the mysensors network, because I would like to add a second arduino gateway with a different radio hardware. Actually I'm using all nodes with nRF24L01+ nodes. I would like to add a RFM69 network as well.
    Can Openhab handle the same time comunication to TWO MQTT brokers?
    I cannot try because I need to buy the needed hardware and I would like to do it only if I know it's working.

    Or In case do you suggest a different approach? Using in example the new gateway with a serial gateway?
    Any suggestion would be really appreciated!

    Many thanks for the help!

    Simon

    1 Reply Last reply
    0
    • dakkyD Offline
      dakkyD Offline
      dakky
      wrote on last edited by dakky
      #2

      maybe the solution is to use an alternative setup:
      Not using the mqtt gateway from the example, but using the mqtt CLIENT gateway (currently on the development branch)

      This allows u to set up an mqtt broker (mosquitto) on your openhap host and the two gateways are sending their messages to this broker instead of being the broker themselves.

      Edit:
      narf. i see the client gateway examples are only for w5100 and ESP8266

      Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
      Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

      Software: MySensors 2.0development

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xefil
        wrote on last edited by
        #3

        Hello @dakky ,
        I've asked the same on OpenHAB and the answer was that it is possible to add a second MQTT Instance:

        https://community.openhab.org/t/mqtt-binging-possible-two-mqtt-broker/5193

        BTW could you give me some other informations on your solution?
        Could I already implement this setup? How?

        Thanks!

        Simon

        1 Reply Last reply
        0
        • dakkyD Offline
          dakkyD Offline
          dakky
          wrote on last edited by dakky
          #4

          The setup itself is working. The problem is, that you're using the RFM69 module as network device. There is no client gateway example for that device and i think i've read somehere here, that it won't become implemented (to large footprint?).

          EDIT:
          in case u're still interested, here a small impression how simple this setup works:

          • install mosquitto on raspbian
            quite simple apt-get install and ready to run
          • modify gateway client example (mac, ip, mqtt broker ip) and uplaod it
            this is a little bit annoying: I needed to upgrade to an arduino mega because the uno was too small for softISP, message singing and debug. But nevertheless ...
          • subscribing to all moqsuitto messages on rasbian:
            mosquitto_sub  -v -t '#'
            
            results in appearing messages from the node
            sensor-gw1-out/99/255/3/0/11 Test Sensor
            sensor-gw1-out/99/255/3/0/12 0.1
            sensor-gw1-out/99/3/1/0/16 1
            
          • item in openhab listening to that event:
            String  sketch_name_99    "Sketch name 99 (Test Item) [%s]"  (sketch,all) { mqtt="<[mysensors:sensor-gw1-out/99/255/3/0/11:state:default]" }
            

          Thats it

          Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
          Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

          Software: MySensors 2.0development

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xefil
            wrote on last edited by
            #5

            @dakky, you mean there is not a controller gateway working with the radios RFM69?
            The doc is mentioning it:

            http://www.mysensors.org/build/connect_radio
            "Wiring the RFM69 Radio"

            Then, on the MQTT gateway side, I've seen in the code:

            (...)
            #include <MyTransportRFM69.h>
            (...)
            // NRFRF24L01 radio driver (set low transmit power by default) 
            MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
            //MyTransportRFM69 transport;
            (...)
            

            So I think it shoud be enough to commet out the MyTransportNRF24 and uncomment the MyTransportRFM69, right??

            Then, I'm not understanding your instructions:

            modify gateway client example (mac, ip, mqtt broker ip) and uplaod it
            this is a little bit annoying: I needed to upgrade to an arduino mega because the uno was too small for softISP, message singing and debug. But nevertheless ...

            Which gateway client? The arduino gateway? It's in listening mode AFAYK also, as soon there is a subscription on it, it would comunicate with it, not?

            And why you need an arduino mega? Isn't it using the same PINS like them on a gateway using the NRF24?

            I would expect that the final result would be, from the controller up to the sensors

            • OpenHAB with two MQTT instances pointing to two MQTT Broker, one for the NRF24 sensors, second for RFM69 sensors
              • Gateway MQTT for the NRF24 sensors
                • NRF24 sensors and repeaters
              • Gateway MQTT for RFM69 sensors
                • RFM69 sensors and repeaters

            So I cannot understood why I need mosquito server :sweat:

            Thanks again for the help!

            Simon

            1 Reply Last reply
            0
            • dakkyD Offline
              dakkyD Offline
              dakky
              wrote on last edited by
              #6

              I use a different kind of setup. I'm not using the mqttGateway example but die mqttClientGateway.
              This means the arduino gateway is not the messagebroker (server) itself, but is forwarding the messages to another broker (mosquitto)

              This allows me to post non-mysensors messages to the broker and openhab can consume them. A external broker is nessecary, because the mqttClientGateway can handle only one single connection (openhab, so no new messages from external tools, no debugging while openhab is connected etc) and i'm much more experienced in using software on the linux side instead on arduino => external broker

              When looking in the examples of mysensors, there are only 2 examples for mqttClientGateways (development branch):

              • GatewayESP8266MQTTClient (wlan afaik)
              • GatewayW5100MQTTClient (shield/module with w5100 chip)

              The Mega is nessecary, because the sketch size with optiboot was 108% of the allowed size without debugging (as far as i remember)
              And Yes the pins are other ones on the mega, but that requires just changing the sketch.

              Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
              Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

              Software: MySensors 2.0development

              1 Reply Last reply
              0
              • X Offline
                X Offline
                xefil
                wrote on last edited by
                #7

                Ok @dakky, it means simply that with your setup you have more control and debug over the mqtt broker. And you are using the mega256 because the soft-spi uses more space.
                My only limitation is I need the MEGA256 and I would like to use my own arduino boards and the network shield I've already purchased.

                BTW my setup should work as well, right?

                Then I could move to your setup when the library will be optimized to stay on an arduino uno/nano/promini... :)

                Thanks!

                Simon

                1 Reply Last reply
                0
                • dakkyD Offline
                  dakkyD Offline
                  dakky
                  wrote on last edited by
                  #8

                  As long as openhab supports (u did already verify that) 2 mqtt connections, you should be fine.

                  Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
                  Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

                  Software: MySensors 2.0development

                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    xefil
                    wrote on last edited by
                    #9

                    Thanks @dakky for the support!!! :-)

                    Simon

                    1 Reply Last reply
                    0
                    • dakkyD Offline
                      dakkyD Offline
                      dakky
                      wrote on last edited by dakky
                      #10

                      You're welcome

                      Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
                      Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

                      Software: MySensors 2.0development

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      29

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular