Hi all, 

I've checked out and installed the MQTT Paho Project provided on this page. It is configured like it is described in the start up tutorial - I'm connecting to the provided MQTT Server "messagesight.demos.ibm.com" on Port 1883 and everything works fine. Sensor data gets written to the broker in the configured timespan and also the subscriber part of the XDK works fine.

Now I want to connect the XDK to my own Mosquitto mqtt broker installed on my own Web Server. I've changed the MQTT Broker Name in "mqttConfig.h" to the IP of my webserver, tried e.g. "http://188.68.59.63", "http://188.68.59.63:1883" and "188.68.59.63" (ip address is fictional, just an example) but it's just not working - don't get any data written to my broker.

 

Whats the correct syntax? What do I have to change to use my own broker?

 

Many thanks in advance! 

+1 (1 Stimme)
RE: Using my own MQTT Broker in MQTT Paho Project
Antwort
22.09.16 13:53 als Antwort auf K Butz.

Hi Korbinian,

The http:// extension that you see normally in URLs, specifies the http protocol and the port 80.
The correct syntax in the XDK MQTT PAHO project is to set the IP of your web server to “188.68.59.63”. 

#define MQTT_BROKER_NAME    "188.68.59.63"  /**< MQTT Broker */

Moreover, you need to set the port:

#define MQTT_PORT            1883           /**< MQTT Port Number */


There may be other issues as well. I would recommend to:
- make sure that your server is reachable in the network of your XDK
- make sure that you did configure the correct port, you can try to publish with another client first.


Kind regards,
Manuel

0 (0 Stimmen)
RE: Using my own MQTT Broker in MQTT Paho Project
Antwort
26.09.16 08:13 als Antwort auf Manuel Cerny.

Hi Manuel,

thanks for your quick reply. Unfortunately this was my first try to use directly the ip address as mqtt broker name ("188.68.59.63") but it didn't work. 

Then I checked, if the MQTT Server is reachable and started up MQTT Mosquitto Subscriber and Producer clients in the same network (on the pc, the xdk is plugged in...). Using this clients, I was able to subscribe and produce my messages on the installed Broker.

Just checked also your suggestion regarding the port - I am always using 1883, in case of xdk as well as in case of my manual client.

Do you have any suggestions how to proceed? What could I try next?

 

Kind regards, Korbinian

0 (0 Stimmen)
RE: Using my own MQTT Broker in MQTT Paho Project
Antwort
26.09.16 15:41 als Antwort auf K Butz.

Hello Korbinian,

it seems to be no issue related to the MQTT settings. I suppose it could be a problem with your Wi-Fi connection. Does your XDK receive an IP and is visible in your network ?

Sometimes the XDK has issues to set the IP via DHCP correctly if a prior application changed the internal state from DHCP to static IP.

Please tell me if this solves your problem.

Kind regards,
Manuel

0 (0 Stimmen)
RE: Using my own MQTT Broker in MQTT Paho Project
Antwort
02.10.16 13:32 als Antwort auf Manuel Cerny.

Hi, 

did some further tests, but i just don't get why it doesn't work. My Scenario:
 

- I have my laptop where the XDK Workbench is running and the XDK is plugged into. IP: 192.168.0.175

- Changed MQTT Config (WLAN settings, client id, mqttBroker="192.168.0.175", port 8883)

- The XDK is in my (W)LAN, it got the IP 192.168.0.85 (can also be pinged)

- After flashing and rebooting the XDK, no LED is blinking and nothing is sent

- The MQTT Server should work regularly, it's a mosquitto server and I published and subscribed some messages manually with a client (installed on my pc) and it worked

---> If i change the MQTT Broker name to e.g. "mqtt.bosch-si.com", the XDK is working, the LEDs are blinking and the status informations gets sent to the mqtt server regularly.

I've also attached a Screenshot which shows my MQTT Server and Clients as well as the mqttConfig.h plus the information, which IP the XDK got (console).

Do you have any further idea, how to troubleshoot this problem?

 

Kind regards, Korbinian

0 (0 Stimmen)
RE: Using my own MQTT Broker in MQTT Paho Project
Antwort
04.10.16 15:42 als Antwort auf K Butz.

Hello Korbinian,

unfortunately it will take some time to find a solution.
I set up a mosquitto broker on my own system and could reproduce your issue.
I will get more into detail with the configuration and paho demo and come back to you till the end of this week.

Kind regards,
Manuel

0 (0 Stimmen)
RE: Using my own MQTT Broker in MQTT Paho Project
Antwort
05.10.16 20:41 als Antwort auf Manuel Cerny.

Hi Korbinian,

I have a running mosquitto server and I’am able to publish with the XDK paho demo without any changes in the paho demo itself except the broker address.

Please be sure that you flashed the newest version of the paho demo, I had the same issue when running an old version.

I would recommend to make sure that the server is reachable by another client in the network. You already verified that you are able to publish from the console on the pc that is running the server but to make sure no firewall denys the access from outside, I would recommend to publish from a second notebook or a raspberry.

Second, I would recommend to run the mosquitto subscriber in debug mode with a wildcard topic to receive all incoming messages:

mosquitto_sub -d -h 127.0.0.1 -p 8883 -t /#

After pressing button 1 to start publishing you should receive all the sensor data from the XDK.

Please tell me if this helps.

Kind regards,
Manuel

0 (0 Stimmen)