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. OpenHab MQTT Gateway Error - Unable to connect to server

OpenHab MQTT Gateway Error - Unable to connect to server

Scheduled Pinned Locked Moved OpenHAB
4 Posts 1 Posters 3.6k 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.
  • B Offline
    B Offline
    bpair
    wrote on last edited by
    #1

    Using openHab 1.6.2 on Windows 7
    Mysensors 1.4
    Followed directions: http://www.mysensors.org/build/mqtt_gateway and also http://forum.mysensors.org/topic/303/mqtt-broker-gateway
    Using an arduino R3 and a W5100 Etherent Shield and NRF24L01 radio wired up just like the web page instructions. When starting openHab I see MQTT errors. Primarily: Unable to connect to server.
    Does anybody have any thoughts on what could be wrong? Attached full debig log. I have tried port 1883 and 1880.

    openhab.log

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bpair
      wrote on last edited by bpair
      #2

      This may be an OpenHab problem. I don't know anything about MQTT but after downloading an MQTT client it appears it can connect where OpenHab cannot. From the MQTT client I can publish some data and see at least some output in the arduino serial console (not the same text).

      I can also see that the MQTT gateway (Mysensors code running on arduino with w5100) appears in my router and I can ping the IP.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bpair
        wrote on last edited by
        #3

        Well I took a break from this and when I returned I realized my mistake. It is a bit embarrassing but I will explain so maybe it helps somebody else.

        openHAB would start and be unable to connect to the mysensor MQTT gateway (Broker). It would throw a timeout error.

        Using the MQTTLens chrome client I could publish mqtt messages and see some output in the serial monitor for the arduino.(Side note baud rate for the monitor must be 115200 to see real output). However I noticed I could never receive messages, only publish.

        That made me think the messages were getting to my arduno mqtt gateway but not leaving. I then looked at my router's port forwarding and sure enough I had it wrong. I had 1883 forwarding to the IP address of my gateway but on port 1883. Since the default mqtt port is 1883 I decided to change my listener port on the arduino. So in the MQTTGateway sketch I changed it to 1880. Then I changed my port forwarding to forward 1883 to my arduino IP on port 1880.

        Now all is working. I hope my mistake can help save somebody some time in the future.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bpair
          wrote on last edited by
          #4

          One more update. The port forwarding was not a complete fix. The real culprit was my Asus RT-N66U router which has LAN-WAN firewall. When enabled it was allowing wan traffic to my gateway but not allowing a response from my gateway out to the controller.

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          50

          Online

          12.0k

          Users

          11.2k

          Topics

          113.4k

          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