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. No connection between Openhab and working MQTT broker (timed out) [SOLVED]

No connection between Openhab and working MQTT broker (timed out) [SOLVED]

Scheduled Pinned Locked Moved OpenHAB
6 Posts 3 Posters 3.3k Views 2 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.
  • D Offline
    D Offline
    DutchMurk
    wrote on last edited by DutchMurk
    #1

    I gradually started to build my first system. After getting experience with the serial gateway, I shifted to the th ethernet Gateway and now want to setup the MQTT gateway. Everything is functioning,** I can see the MQTT updates in MQTTlens (temperature readout)** but by no means I can connect my Openhab system to the MQTT broker on the Arduino UNO. I get a timeout connection error all the time:

    21:14:10.253 ERROR o.o.i.t.mqtt.MqttService[:114] - Error starting broker connection
    org.eclipse.paho.client.mqttv3.MqttException: Unable to connect to server
    at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:75)
    at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:538)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:66)
    at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:538)
    at java.lang.Thread.run(Unknown Source)

    I have googled for any solution and I checked double-checked all my settings but I am out of ideas, specially because I can connect/receive messages from the MQTT broker to my android phone and my desktop. Anyone any suggestions where to look ?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yancym
      wrote on last edited by
      #2

      Is your MQTT binding set up in OpenHAB.cfg? What are the settings?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DutchMurk
        wrote on last edited by
        #3

        The set-up in Openhab was working because I was able to connect to another MQTT server on my Synology. I just changed the code a little by also defining the DNS server and subnet mask

        #define TCP_PORT 1883 // Set your MQTT Broker Listening port.
        IPAddress TCP_IP ( 192, 168, 0, 9 ); // Configure your static ip-address here
        byte gateway[] = { 182, 168, 0, 1 };
        byte subnet[] = { 255, 255, 255, 0 };
        byte TCP_MAC[] = { 0x02, 0xDE, 0xAD, 0x00, 0x00, 0x42 }; // Mac-address - You should change this! see note *2 above!

        and

        void setup()
        {
        Ethernet.begin(TCP_MAC, TCP_IP, gateway, subnet);

        and it seems and I can connect now during the last two restarts (but I also powered-off my netwerk switch in between). Let's see how it will last.....

        D 1 Reply Last reply
        0
        • D DutchMurk

          The set-up in Openhab was working because I was able to connect to another MQTT server on my Synology. I just changed the code a little by also defining the DNS server and subnet mask

          #define TCP_PORT 1883 // Set your MQTT Broker Listening port.
          IPAddress TCP_IP ( 192, 168, 0, 9 ); // Configure your static ip-address here
          byte gateway[] = { 182, 168, 0, 1 };
          byte subnet[] = { 255, 255, 255, 0 };
          byte TCP_MAC[] = { 0x02, 0xDE, 0xAD, 0x00, 0x00, 0x42 }; // Mac-address - You should change this! see note *2 above!

          and

          void setup()
          {
          Ethernet.begin(TCP_MAC, TCP_IP, gateway, subnet);

          and it seems and I can connect now during the last two restarts (but I also powered-off my netwerk switch in between). Let's see how it will last.....

          D Offline
          D Offline
          DutchMurk
          wrote on last edited by
          #4

          My set-up is stable now for a couple of days, even with reboots of MQTT server and my network switch

          1 Reply Last reply
          0
          • Shedrick BellS Offline
            Shedrick BellS Offline
            Shedrick Bell
            wrote on last edited by
            #5

            Did you find a fix? I'm having the same problem

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DutchMurk
              wrote on last edited by
              #6

              My fix was listed above. restarting the routers and defining the static IP

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


              13

              Online

              11.7k

              Users

              11.2k

              Topics

              113.0k

              Posts


              Copyright 2019 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