OpenHab MQTT Gateway Error - Unable to connect to server
-
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.
-
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.
-
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.
-
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.
Suggested Topics
-
Boxes and Enclosures
Enclosures / 3D Printing • 29 Mar 2014, 21:02 • PITP2 31 Aug 2014, 19:27 -
OH3, RPi3, GPIO-NRF24 gateway. MySensors binding (ETH or MQTT?)
OpenHAB • 30 Sept 2021, 10:24 • perIpI 1 Oct 2021, 09:19 -
MQTT losing messages...
OpenHAB • 8 Jul 2022, 11:27 • ben999 17 Jul 2022, 18:00 -
voltage sensor via esp and mqtt
OpenHAB • 7 Nov 2020, 09:49 • muhammed 7 Nov 2020, 09:49 -
openHAB 2.5 binding and V_VARx
OpenHAB • 25 May 2020, 15:49 • syntacrsc 4 May 2022, 20:47 -
OH2.5.9 / ethernet gateway / autodiscovery?
OpenHAB • 20 Oct 2020, 15:31 • Stefferd 22 Oct 2020, 13:38