MY_GATEWAY_MQTT_CLIENT



  • Hi,

    I am trying to setup a MQTT (client) ethernet gateway using an UNO R3, W5100 ethernet shield, and Adafruit RFM69HCW.

    The nodes are communicating well with gateway using #define MY_GATEWAY_W5100; but I am having no luck when i change it to #define MY_GATEWAY_MQTT_CLIENT, and am getting the following error :

    34779 GWT:TPC:IP=192.168.1.177
    35781 GWT:RMQ:CONNECTING...
    37785 !GWT:RMQ:FAIL
    
    // Enable gateway ethernet module type
    //#define MY_GATEWAY_W5100
    #define MY_GATEWAY_MQTT_CLIENT
    
    // Set this node's subscribe and publish topic prefix
    #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
    #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
    
    // Set MQTT client id
    #define MY_MQTT_CLIENT_ID "mysensors-1"
    
    #define SD_SS_PIN (4)  // chip-select for SD card (normally unused, pull high!, see code!) 
    
    // Enable these if your MQTT broker requires username/password
    //#define MY_MQTT_USER "username"
    //#define MY_MQTT_PASSWORD "password"
    
    // Enable MY_IP_ADDRESS here if you want a static p address (no DHCP)
    #define MY_IP_ADDRESS 192,168,1,177   // If this is disabled, DHCP is used to retrieve address
    #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
    
    // If using static ip you can 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 "m20.cloudmqtt.com"
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 225
    
    // The MQTT broker port to to open
    //#define MY_PORT 1883
    

    I can connect to the MQTT broker (which is my openhab instance on 192.168.1.225)
    without username and password)

    I have read lots but become even more confused 😕

    In addition to #define MY_GATEWAY_MQTT_CLIENT, what else should be set? How can i see if there is even an attempt to contact the broker?

    many thanks



  • OMG!!! i feel such a fool!

    Spent a good hour searching - and immediately after posting the above - realised the ethernet cable was unplugged!!!!

    facepalm!

    😊



  • actually it was longer than that 😕



  • This is a good tip to add to the build instructions. Check if you plugged the cable 😂


Log in to reply
 

Suggested Topics

  • 3
  • 3
  • 2
  • 2
  • 1
  • 15

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts