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.
-
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