[SOLVED] Cannot get GwWS5100MQTT to connect to cloudmqtt.com



  • Hi!
    I have been tinkering with MySensors for a while now and the goal is to build a HA-system using OpenHAB. For that purpose I want to use a public MQTT broker at cloudmqtt.com. I have built the WS5100MQTT client downloaded from GitHub, using an Arduino Nano and MySensors 2.0 API. I have also built and tested a few sensors which work fine.

    It all works fine part from the issue that I cannot get the client to connect to the cloudmqtt server (m21.cloudmqtt.com) It just tries and tries about every second and on the cloudmqtt log I can see the connection attempts. Cloudmqtt assigns various ports and you cannot choose port number. Ports I have used are e.g. 15536 and 19946. They are not SSL ports.

    I have also tried to connect to a test broker at broker.hivemq.com port 1883 and there the client connects immediately and starts publishing topics.

    I have tried both the Arduino 1.6.11 release and now the 1.6.9 release, both on Windows and Mac.

    So, I have reached the end of the road as far as my knowledge goes. Any ideas are appreciated.


  • Mod

    Welcome to the NySensors community @bgunnarb! Does the serial debug output say anything interesting?



  • Here is a printout at startup:

    0;255;3;0;9;Attempting MQTT connection...
    IP: 192.168.1.210
    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    IP: 192.168.1.210
    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    IP: 192.168.1.210
    0;255;3;0;9;Attempting MQTT connection...
    IP: 192.168.1.210
    0;255;3;0;9;Attempting MQTT connection...
    IP: 192.168.1.210
    0;255;3;0;9;Attempting MQTT connection...
    IP: 192.168.1.210
    0;255;3;0;9;Attempting MQTT connection...

    I am using a fixed IP but have also tried with DHCP without success.



  • Here is a copy of the parameter setup in the sketch:

    // Enable these if your MQTT broker requires usenrame/password
    #define MY_MQTT_USER "xxxxxxxx"
    #define MY_MQTT_PASSWORD "yyyyyyyyy"

    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    #define MY_IP_ADDRESS 192,168,1,210

    // If using static ip you need to define Gateway and Subnet address as well
    #define MY_IP_GATEWAY_ADDRESS 192,168,1,1
    #define MY_IP_SUBNET_ADDRESS 255,255,255,0

    // MQTT broker ip address or url. Define one or the other.
    #define MY_CONTROLLER_URL_ADDRESS "m21.cloudmqtt.com"
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 201

    // The MQTT broker port to to open
    #define MY_PORT 19946


  • Admin

    Could it be something blocking in your router?



  • I have tried opening the port e.g. 19946 to tcp-traffic but no change. Should the port be open to udp as well?



  • I get the same error, using cloudmqtt and also using a python mqtt broker that i have locally installed. It never completes the connect part. Using 2.0 API


  • Mod

    @bgunnarb maybe the mqtt version of the mysensors client is not supported by the broker. I remember a similar issue in the past where RPI contained an older version of mosquitto and that also silently failed.
    Could also be the reason why it works with one broker and fails on another.
    Can you find out the mqtt protocol versions supported by the various brokers?



  • @Yveaux I am so terribly embarrassed! In order to rule out something wrong with the WS5100 I rebuilt the GW using an old Arduino UNO with an Ethernet shield. Still same problem. Then to really make sure I pasted/copied username and password from the cloudmqtt into the sketch. Immediate success! It turned out that I had misread an uppercase I (indigo) for a lower case l (lima). Still the suggestions from the community were good since I could iron out one possible cause after another. Thanks for the support!


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 4
  • 3
  • 15
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts